Comment #7 on issue 1662 by [email protected]: Excessive overhead of String.replace(/a/g,'b')
http://code.google.com/p/v8/issues/detail?id=1662

Apologies... the 40% comes from the attached test. It does replace() 100 times to dilute all other operations. In vanilla 9145, AtomExec ate 30%, see the profile and the test case attached.

$ ./d8 --prof test-d8.js
started: String.replace performance test
1mln char array composed in 34ms
array joined in 4ms
1mln symbol string: all symbols replaced 100 TIMES in 8101ms
too smart optimizations excluded 1000000 1000000 1000000

 [C++]:
   ticks  total  nonlib   name
2487 30.7% 30.8% v8::internal::RegExpImpl::AtomExec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>) 928 11.5% 11.5% v8::internal::CompiledReplacement::Apply(v8::internal::ReplacementStringBuilder*, int, int, v8::internal::Handle<v8::internal::JSArray>)
    664    8.2%    8.2%  v8::internal::String::GetFlatContent()


Attachments:
        v8.log.gz  40.2 KB
        test-d8-100.js  611 bytes

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

Reply via email to