Reserve capacity for StringBuilder in unescape
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Jan 2017 16:19:33 +0000 (16:19 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Jan 2017 16:19:33 +0000 (16:19 +0000)
commit0e0510aef52b88017310c71e069b25396ea252f5
tree2843c03d158218ac430a8ecad10887c4dfaf1d1d
parent9295ee9677b6f1d88b55981b801772ac6391d24a
Reserve capacity for StringBuilder in unescape
https://bugs.webkit.org/show_bug.cgi?id=167008

Reviewed by Sam Weinig.

JSTests:

* stress/unescape.js: Added.
(shouldBe):

Source/JavaScriptCore:

`unescape` function is frequently called in Kraken sha256-iterative.
This patch just reserves the capacity for the StringBuilder.

Currently, we select the length of the string for the reserved capacity.
It improves the performance 2.73%.

    Benchmark report for Kraken on sakura-trick.

    VMs tested:
    "baseline" at /home/yusukesuzuki/dev/WebKit/WebKitBuild/untot/Release/bin/jsc
    "patched" at /home/yusukesuzuki/dev/WebKit/WebKitBuild/un/Release/bin/jsc

    Collected 100 samples per benchmark/VM, with 100 VM invocations per benchmark. Emitted a call to gc() between
    sample measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the jsc-specific preciseTime()
    function to get microsecond-level timing. Reporting benchmark execution times with 95% confidence intervals in
    milliseconds.

                                               baseline                  patched

    stanford-crypto-sha256-iterative        51.609+-0.672             50.237+-0.860           might be 1.0273x faster

    <arithmetic>                            51.609+-0.672             50.237+-0.860           might be 1.0273x faster

* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncUnescape):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/unescape.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp