JavaScript performance
Posted: 2021-06-18, 17:29
It's a normal script to calculate a series by recursion. The only thing different is I changed the iterator from 1 to 10000 to 1 to 1000000000.
Chrome completed the script in about 9s. Basilisk meanwhile ran about a minute then display a message asked me to stop the script. The browser is unresponsive while the script being run, so I choose to stop the script. Everything back to normal.
I don't have FF to test if it survive or not. But from this experience, I know for sure why sometimes the browser just hangs on JavaScript heavy site. Not only because these sites use too new JavaScript features the browser not yet supported, but also because the JavaScript engine is too slow.
I downloaded both Microsoft ChakraCore (seems abandoned since they switch to V8) and Mozilla JSShell. Both of them completed the script about 12s and 11s respectively. I surprised that ChakraCore is actually slower than Mozilla!
I wonder if the JavaScript engine we use is the same as FF? They seems to be the same name, SpiderMonkey. But I think we are different, don't we? Because our SpiderMonkey doesn't need Rust. Mozilla SpiderMonkey seems to need Rust. Ours could be an old version of SpiderMonkey, before Rust, I think.
Please correct me if I'm wrong.
p/s: V8 is just incredible. I wonder how much money actually pulled into it. Meanwhile, Mozilla Rhino can't even complete the script. It ran for 15 minutes without any signs it will be able to complete it at all, so I have to cancel it. Bellard's QuickJS took more than 5 minutes to complete the script.
Chrome completed the script in about 9s. Basilisk meanwhile ran about a minute then display a message asked me to stop the script. The browser is unresponsive while the script being run, so I choose to stop the script. Everything back to normal.
I don't have FF to test if it survive or not. But from this experience, I know for sure why sometimes the browser just hangs on JavaScript heavy site. Not only because these sites use too new JavaScript features the browser not yet supported, but also because the JavaScript engine is too slow.
I downloaded both Microsoft ChakraCore (seems abandoned since they switch to V8) and Mozilla JSShell. Both of them completed the script about 12s and 11s respectively. I surprised that ChakraCore is actually slower than Mozilla!
I wonder if the JavaScript engine we use is the same as FF? They seems to be the same name, SpiderMonkey. But I think we are different, don't we? Because our SpiderMonkey doesn't need Rust. Mozilla SpiderMonkey seems to need Rust. Ours could be an old version of SpiderMonkey, before Rust, I think.
Please correct me if I'm wrong.
p/s: V8 is just incredible. I wonder how much money actually pulled into it. Meanwhile, Mozilla Rhino can't even complete the script. It ran for 15 minutes without any signs it will be able to complete it at all, so I have to cancel it. Bellard's QuickJS took more than 5 minutes to complete the script.