4 ms·
> well in most languages you can wrap sync into async. so it's not "hard" It is not easy to do in a cirrect and performant way. "async" doesn't mean "code tha
by mrighele 7y ago
> well in most languages you can wrap sync into async. so it's not "hard"
It is not easy to do in a cirrect and performant way. "async" doesn't mean "code that runs in another thread". You can have a single threaded runtime running async code (that's usually the case for javascript).
The "async-ness" is in those cases provided by the use of non-blocking primitives for IO, network etc. If a function is making a blocking call to the file system even if you make it async it will not help since the main thread will still be blocked on that system call.
The performance will also be quite different: waiting for data on 10000 sockets in a non-blocking way is quite different from having 10000 threads doing the same.