Improve replaceUsingStringSearch() for case of a single character searchValue
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 02:30:03 +0000 (02:30 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 02:30:03 +0000 (02:30 +0000)
commitb1f2cdaed62f9478900bea517d8d4276e328206b
treefc3919c7f7f72d3fb3768d034c04812da5a617fa
parent19569d2bde526c89fa2c60751ac9b244aeecb77f
Improve replaceUsingStringSearch() for case of a single character searchValue
https://bugs.webkit.org/show_bug.cgi?id=83738

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-04-12
Reviewed by Geoffrey Garen.

This patch improves replaceUsingStringSearch() with the following:
-Add a special case for single character search, taking advantage of the faster WTF::find().
-Inline replaceUsingStringSearch().
-Use StringImpl::create() instead of UString::substringSharingImpl() since we know we are in the bounds
 by definition.

This gives less than 1% improvement for the multicharacter replace.
The single character search show about 9% improvement.

* runtime/StringPrototype.cpp:
(JSC::replaceUsingStringSearch):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/StringPrototype.cpp