As libraries seem to evolve, making it easier to program, it seems people are using JS for more things that Java would have been used for in its heyday.
That said, there are many performance problems with JS that we are aware of and just one of them is the ability to optimize runtime using threads.
I saw this: Why doesn't JavaScript support multithreading?, but that was answered 3-4 years ago (and a lot changes in a year, let alone 3-4). With HTML5 growing fast, I'm even more curious if this has been given more consideration.
You should ask, ECMA TC39, they own ECMAScript.
But the short answer will be no, if you have long-running scripts that you want to "spawn a new thread" for you should check out WebWorkers, they run in their own context and technically on another thread.
I think what we'll see over time is an expansion of what WebWorkers can do and how they can communicate with the main javascript thread. Today it's very limited, but there are ways that it could be made more powerful without risking the stability and simplicity of having the main javascript thread being single threaded.
For example, today you can't load images or prepare graphics in a WebWorker, but that would be incredibly useful for graphics intensive applications. You can do calculations, but are limited at that.
For example, you can't manipulate DOM objects for animations in any sort of background process. That also would be very useful - thought more complicated for the browser engine to implement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With