Why was sleep_ms() deprecated? [closed] - rust

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I know there is a function sleep() that is more flexible, as it accepts a Duration as a parameter. Obviously, in many cases that could be more convenient. But from my personal experience with other languages, most of the time I need to put a thread to sleep for milliseconds or seconds, rather than hours or days. So in most cases something like this:
thread::sleep_ms(500);
would be much more convenient than this:
use std::time::Duration;
thread::sleep(time::Duration::from_millis(500));
This question isn't about which of the two functions is better. I personally think there is room for both, but that is subjective, of course.
My question is, was there any special, non-obvious reason for the deprecation of sleep_ms()? I tried to find info on the topic, but to no avail.

Thanks to dratenik's and eggyal's comments, I believe it is correct to summarize that the main reason for deprecating sleep_ms() is that the Rust core devs believe the right way to go should be to work on adding less verbose ways to pass a Duration value.
Here is what is comming:
#![feature(duration_constants)]
use std::time::Duration;
thread::sleep(2 * Duration::SECOND);

Related

What is a simple definition for a CPU intensive application to answer in an interview? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I got asked during an online interview:- What is CPU Intensive Application? Answer it in 3-4 lines (briefly). I just want the simple definition that can be explained with few-real world examples.
Doesn't get any simpler than this forever loop:
while (true) {}
To explain this, just remember that nodejs is single-threaded, so anything that blocks the event-loop is bound to turn the process into a CPU-hungry beast. Of course the kernel is free to schedule the nodejs process as it sees fit, but the truth of the matter is that only that loop will get a chance to do anything meaningful in your program.
See also Don't Block the Event Loop

Skill needed to do advance level sas programming [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
what is the best procedure to increase advance level SAS programming skill when there is no such requirement to use those concepts. Most of the time I complete my task using basic SAS concepts like set function, merge function or some other basic function. What is your suggestion if one wants to increase the programming capabilities.
I'm not going to venture a single 'best' option, but here are a few ideas:
I haven't gone down this route myself, but you could look into studying for the SAS certifications to broaden your SAS knowledge.
If you don't already know any SQL, that's something that's probably worth learning, as it's more transferable than most other SAS-related knowledge.
If you find yourself writing lots of very similar bits of code, learn how to use arrays and write macros (and when not to write macros).
If your code is taking a long time to run, read up on optimisation techniques and see if you can find faster ways of doing the same things. E.g. hash objects, indexes and parallel processing.

How PLINQ is better than traditional threading? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Currently I have n suppliers web service which gives me search result for particular product. I am creating n threads myself and merging the final results returned by supplier. I have just come to know about PLINQ. I want to know if it would help the performance. If yes, how.
Better? Depends on what that means for you. PLINQ is definitely cleaner and more maintainable code for a lot of use cases. On the performance side depends on what you compare it against.
In your case if you are creating n threads by hand i would say you might be slower because PLINQ will use the threadpool and avoid some thread creation overhead.

What UML Use Cases to Write? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
It's been a really long time since I worked with UML Diagrams.
I started working with UML Use Cases again, for a real world project. I would like to ask some questions.
How should I approach writing use cases?
I believe the tasks that leads to a "Major/Bigger" task should not be considered as use cases by themselves. Am I right?
Okay, what if I have a task like View tutorial and it has Comment on Tutorial, Favourite Tutorial, etc. Should these be separate use case, Extending View Tutorial? If yes, but, aren't they small features, why we should include them?
I'm mixing some stuff here, I hope someone could enlighten me .
Thanks!
Read Alistair Cockburn's Effective Use Cases book (see it on Amazon: 1). He does an excellent job of explaining practical use of use cases in a structured and effective way.

Why node.js does not have something like goroutines from Go? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I wonder why callback hell did not get some conceptual solution. Something like goroutines from Go, stackless python, eventlet, gevent, monkey patching or something like that. Is it possible to make it for javascript? Does anybody work on it? JavaScript is a great concise language but the callback hell is a major drawback.
because those are language features and Javascript doesn't have them.
I think there's talk about finally getting coroutines, but I don't know the details.

Resources