Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Browsers keep improving JS speed, but is there an upper limit to how fast it can be? How far off is it from something like C ?


There might be an upper limit on the speed of the language itself, but what has a lot more room for improvement is speed of DOM operations and DOM rendering. Since you could involve all kinds of fancy graphics hardware acceleration in that, as IE9 is purported to do, there's a lot more to be done there.

Most JS developers agree now that the slowest operations are DOM operations so they are avoided as much as possible.


JS speed has improved so much recently due to optimisations like JIT (Just In Time compiling). There will be an upper limit eventually but we haven't hit it yet.

It's damn fast but still a high-level interpreted language - time is taken for a program in the browser to compile it on the fly and run.

It wont hit the speed of well written C code, but most things don't need that speed anyway.


I was browsing the language shootout the other day and came across the page for the regex test. I'm not sure how it's doing it or if something is wrong with the test but V8 is outperforming everything else, including C. That's the only test it leads though.

Here are the results: http://shootout.alioth.debian.org/u32/performance.php?test=r...

Also worth noting that TraceMonkey isn't too far behind. Does anyone know why the JS engines, especially V8, are performing so well on this test?

P.S. Here's how V8/TraceMonkey stack up for all the tests: http://shootout.alioth.debian.org/u32/which-programming-lang...


V8 JIT-compiles regular expressions. I don't know what C/C++ do -- I'd assume they run the state machine directly, but maybe they do compile it further like V8 does.

http://blog.chromium.org/2009/02/irregexp-google-chromes-new...



Look at the source code of the C program. It uses glib and the TCL libraries and it even includes locking for the multicore benchmark.


Look at the source code of the other C regex-dna programs which don't use glib or Tcl libraries.


The Mozilla blog recently posted something about this, saying how all the major browsers are approaching the upper limit of JS speed. Can't find that post now though, but pretty sure it was a HN submission.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: