Hacker News new | ask | show | jobs
by bennysaurus 5698 days ago
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.

1 comments

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.