Skip to content

Conversation

@FWeinb
Copy link

@FWeinb FWeinb commented Nov 26, 2013

I was playing with RegEx so i tried to come up with a RegEx way of
handling the TextTemplate in Rivets. And (at least in Chrome) the
solution is nearly twice as fast.

You can find the perf test here: http://jsperf.com/parse-string-regex

It’s is quite astonishing how much better V8 can handle regular
expressions.

If other browser catch up with the RegEx performance this could be a better solution.

I was playing with RegEx so i tried to come up with a RegEx way of
handeling the TextTemplate in Rivets. And (at least in Chrome) the
solution is nearly twice as fast.

You can find the perf test here: http://jsperf.com/parse-string-regex

It’s is quite astonishing how much better V8 can handel regular
expressions.
@jhnns
Copy link
Contributor

jhnns commented Nov 28, 2013

It would also be faster to cache the regex that has once been compiled.

@mikeric
Copy link
Owner

mikeric commented Aug 2, 2014

@FWeinb Thanks for the pull request. Seems like Safari 7 is still behind with this, the "Parse by Hand" code runs much faster in Safari, but the "Simple Regex II" runs even faster in Chrome. Tough decision to merge this, will keep it open for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants