Closed Bug 1369762 Opened 7 years ago Closed 7 years ago

Avoid string atomization in FinishBoundFunctionInit when the bound target name is empty

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

These Function#bind() calls from Speedometer still show up in profiles, because of the function name atomization overhead in JSFunction::getUnresolvedName():
https://github.com/WebKit/webkit/blob/c3cb7eecbd14e0cf97f55b1014340e5b474da8d1/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/react/js/app.jsx#L292-L294

"setState" is a bound function created in https://github.com/WebKit/webkit/blob/c3cb7eecbd14e0cf97f55b1014340e5b474da8d1/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/react/node_modules/react/dist/react.min.js , but luckily it's anonymous function, so we can optimize for this case in JSFunction::getUnresolvedName() by special-casing empty function names. Yay! :-/
Attached patch bug1369762.patchSplinter Review
Improves this µ-benchmark (should be similar to the React benchmark from Speedometer) from 540ms to 330ms.

    var o = {};
    o.m = function(){}.bind(o);
    var t = Date.now();
    for (var i = 0; i < 5000000; ++i) o.m.bind();
    print(Date.now() - t);
Attachment #8873877 - Flags: review?(till)
Blocks: 1245279
Comment on attachment 8873877 [details] [diff] [review]
bug1369762.patch

Review of attachment 8873877 [details] [diff] [review]:
-----------------------------------------------------------------

r=me, that's an excellent speedup for such a small change.
Attachment #8873877 - Flags: review?(till) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/45eded6a52c0
Don't atomize empty function names when retrieving the unresolved name of a bound function. r=till
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/45eded6a52c0
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: