[Webkit-unassigned] [Bug 188882] String.concat() significantly slower than '+' operator

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 27 02:12:12 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=188882

--- Comment #2 from Keith Miller <keith_miller at apple.com> ---
It looks like you are seeing such a large difference because the test is passing more than one argument to concat at the same time. This causes us to emit a loop which is slowing that code down.

If you change your test to:

string1.concat(string2).concat(string3);

you will see that the perf is quite close. In theory we could do some loop unrolling to fix this but the same issue applies to calling the '+' operator in a loop.

The join case is slow because it will allocate an Array, which is expensive. We could also optimize this but it's probably easier to use the concat method for now.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180827/7ebde479/attachment.html>


More information about the webkit-unassigned mailing list