3 ms·
JavaScript is single-threaded, but in the most popular runtimes, almost all I/O is event-based. This is a great difference from Ruby where library functions are
by pavlov 5y ago
JavaScript is single-threaded, but in the most popular runtimes, almost all I/O is event-based. This is a great difference from Ruby where library functions are blocking (or at least were when I last used the language many years ago).
A single thread of execution for scripts isn't so bad when those scripts are all relatively small callbacks.
- ComputerGuru 5y agoYeah, it's fine for "reactive" processing but not for anything where you'd actually spin up a separate thread (or use a threadpool thread) in a lower-level language - i.e. to perform cpu-intensive calculations/computations in parallel. In practice, JS being single-threaded isn't an obstacle for the uses the developers using JS are after. It doesn't sound like Ruby 3 affords the same with its GIL (but all I'm going off of is TFA).