Reviewers: Lasse Reichstein,

Message:
Previous implementation of string.replace would call the chain
RegExpImpl::Exec->RegExpImpl::AtomExec->SearchString including all the type
checks, conversions, determining search strategy, etc. for every single match,
which makes this rather slow.

This would speed up the most used cases for string.replace, for example when a string is replaced with URL encoded characters. For a specially designed test
case the performance improvement almost reaches 70%.

Please take a look.


http://codereview.chromium.org/7782028/diff/1/src/runtime.cc
File src/runtime.cc (right):

http://codereview.chromium.org/7782028/diff/1/src/runtime.cc#newcode2773
src/runtime.cc:2773: char pattern,
Moved up from further below.

http://codereview.chromium.org/7782028/diff/1/src/runtime.cc#newcode2795
src/runtime.cc:2795: Vector<const SubjectChar> subject,
Moved up from further below.

http://codereview.chromium.org/7782028/diff/1/src/runtime.cc#newcode2820
src/runtime.cc:2820: {
Refactored code from Runtime_StringSplit.

Description:
Faster non-regexp global string.replace.
BUG=v8:1662

Please review this at http://codereview.chromium.org/7782028/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/runtime.cc


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to