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

RESOLVED FIXED in Firefox 55

Status

()

RESOLVED FIXED
a year ago
a year ago

People

(Reporter: anba, Assigned: anba)

Tracking

(Blocks: 1 bug)

Trunk
mozilla55
Points:
---

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

a year ago
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! :-/
(Assignee)

Comment 1

a year ago
Created attachment 8873877 [details] [diff] [review]
bug1369762.patch

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+

Comment 4

a year ago
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

Comment 5

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/45eded6a52c0
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.