by fao_ · 9y ago · 0 comments
while (true) { var d = new Date; e.textContent = d.toLocaleString(); }
I immediately realised my stupidity, and closed the tab. Shortly after, my mouse froze up, then my keyboard access, and eventually my entire access. Rather than just freezing Xorg as I had initially suspected, it froze my entire computer access. No SysReq, no switching to a tty, nothing.I was an idiot, but at the same time, an unprivileged process should not be able to consume resources like that without a dæmon coming in and pausing/killing it. And the Javascript should not have been allowed to execute once I had closed the window.
Truly, Javascript is eating the world.
Or perhaps the language has nothing to do with your problem.
The implementations are what matter. They're the only thing that matters. It's the business axiom "Ideas are worthless, it's the implementation that counts" at work.
Ask yourself this: If V8's performance was still at 2010 levels, would Node exist?
And if some other language were the one which had been picked for browsers - JavaScript relegated to only running on servers - I wager JavaScript would hardly be used at all.
Language != compiler
Language != library
Language != SDK
That being said, JS sucks for large projects.
I had a similar experience on macOS with Chrome Canary watching a YouTube movie full screen. My laptop simply froze, nothing, except a restart, worked.