I use the JavaScript parser generator JISON to create a parser for some scripts that my users create. Lately I\'ve noticed that the parsing process on Firefox is by a large fact
It is the RegExp
capturing grouping that got you:
/^[0-9]+/
and/or /^(?:[0-9])+/
and/or /^([0-9]+)/
are orders of magnitude faster than /^([0-9])+/
. And they should be viable alternatives.
I would expect it to be slightly slower with capturing groups, but that it is that much slower surprises me. However the slow version has the potential to create lots and lots of captures, while the other versions do not, so that seems to be an important difference.
Unscientific jsperf.
You may want to file a bug.