4 ms·
Node's regular expression engine will run circles around almost every other language implementation out there.[0] This is thanks to Google's work on V8.[1] Rege
by beering 11y ago
Node's regular expression engine will run circles around almost every other language implementation out there.[0] This is thanks to Google's work on V8.[1] Regexes are, maybe surprisingly, one of the few things that Node is good at.
[0] http://benchmarksgame.alioth.debian.org/u32/performance.php?test=regexdna http://benchmarksgame.alioth.debian.org/u32/performance.php?...
[1] http://blog.chromium.org/2009/02/irregexp-google-chromes-new-regexp.html http://blog.chromium.org/2009/02/irregexp-google-chromes-new...
- graemep 11y agoI did not know that V8 was that good as regexes. TCL is very fast, but it is quite likely that Node is faster. On the other hand, I think the point that real world performance will depend on the task in hand stands.
- klibertp 11y agoNothing really surprising here. Regexes are the only way to do more advanced text manipulation in JavaScript, so they're being used far more than in other languages. Lua is similar here, having only a couple most basic string operations built-in and relying on regexes for anything even slightly more advanced. This makes it natural for these languages' implementations to focus heavily on optimizing regexes. Also, regexes are easily JITable and of course implementations having a JIT are going to be much more performant than normal interpreters. This explains the results of your [0] - I didn't check, but I suppose it's a vanilla Lua interpreter and not LuaJIT.