Closed
Bug 1355096
Opened 7 years ago
Closed 1 year ago
Regression in performance of Function.prototype.bind and calling bound functions
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
112 Branch
People
(Reporter: till, Assigned: jandem)
References
(Blocks 1 open bug)
Details
(Keywords: perf, regression)
Attachments
(1 file)
6.07 KB,
text/plain
|
Details |
The benchmark in bug 1000780 used to show us with little or no overhead for bound functions that can use the fast-path - those with fewer than 3 bound arguments and fewer than 6 call args. This was true for both the call and construct case. Now, we're at least 2x as slow on the call case - with no bound or call args - and 3x as slow for 2 bound and 3 call args. We're also *much* slower on the slow path: ~ 32x for calling a bound function vs an unbound one with 10 args ~ 47x for constructing a bound function vs an unbound one with 10 args ~ 16x for calling a function with 3 bound args with 2 call args vs calling an unbound function with 5 args ~ 33x for constructing a function with 3 bound args with 2 call args vs constructing an unbound function with 5 args Additionally, v8 got much faster on all of this, including the performance of Function.prototype.bind itself: they're now either roughly as fast as us in call/construct perf (when we hit the fast path) or much faster (when we don't). And calling bind itself is 5-7x as fast as for us. Detailed results for SpiderMonkey: --- binding performance --- Self-h bind, 0 args: 540 Self-h bind, 2 args: 625 Self-h bind, 3 args: 639 Self-h bind, 5 args: 657 --- calling performance --- call unbound, 0,0 args: 28 call bound, 0,0 args: 49 call bound, 2,0 args: 62 call bound, 5,0 args: 101 call bound, 2,3 args: 87 call bound, 2,7 args: 656 call bound, 2,8 args: 844 call bound, 3,2 args: 449 call unbound, 0,5 args: 27 call unbound, 0,10 args: 29 call bound, 0,5 args: 81 call bound, 0,10 args: 949 --- constructing performance --- construct unbound, 0,0 args: 14 construct bound, 0,0 args: 185 construct bound, 2,0 args: 200 construct bound, 5,0 args: 266 construct bound, 2,3 args: 230 construct bound, 2,7 args: 875 construct bound, 3,2 args: 594 construct unbound, 0,5 args: 18 construct unbound, 0,10 args: 23 construct bound, 0,5 args: 232 construct bound, 0,10 args: 1074 Detailed results for node 7.5.0: --- binding performance --- Self-h bind, 0 args: 82 Self-h bind, 2 args: 112 Self-h bind, 3 args: 105 Self-h bind, 5 args: 128 --- calling performance --- call unbound, 0,0 args: 53 call bound, 0,0 args: 69 call bound, 2,0 args: 84 call bound, 5,0 args: 93 call bound, 2,3 args: 108 call bound, 2,7 args: 157 call bound, 2,8 args: 164 call bound, 3,2 args: 90 call unbound, 0,5 args: 97 call unbound, 0,10 args: 113 call bound, 0,5 args: 77 call bound, 0,10 args: 99 --- constructing performance --- construct unbound, 0,0 args: 31 construct bound, 0,0 args: 120 construct bound, 2,0 args: 131 construct bound, 5,0 args: 187 construct bound, 2,3 args: 172 construct bound, 2,7 args: 253 construct bound, 3,2 args: 179 construct unbound, 0,5 args: 30 construct unbound, 0,10 args: 32 construct bound, 0,5 args: 158 construct bound, 0,10 args: 214
Comment 1•7 years ago
|
||
Fixing this bug should include putting a benchmark on AWFY so we don't regress this again.
Updated•7 years ago
|
Blocks: sm-js-perf
Priority: -- → P2
Comment 2•6 years ago
|
||
Moving to p3 because no activity for at least 1 year(s). See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
Updated•2 years ago
|
Severity: normal → S3
Assignee | ||
Comment 3•1 year ago
|
||
Below are numbers for the latest bind
rewrite (in ms, before => after). Things are generally faster with fewer perf cliffs for larger number of (bound and call) arguments. I think we can close this bug because we fixed the worst issues mentioned in comment 0. To do better we need inlining support for bound functions; I'll file a separate bug for that.
--- binding performance ---
Self-h bind, 0 args: 184 => 45
Self-h bind, 2 args: 193 => 35
Self-h bind, 3 args: 245 => 36
Self-h bind, 5 args: 246 => 306
--- calling performance ---
call unbound, 0,0 args: 9 => 9
call bound, 0,0 args: 32 => 21
call bound, 2,0 args: 35 => 24
call bound, 5,0 args: 72 => 54
call bound, 2,3 args: 55 => 54
call bound, 2,7 args: 270 => 42
call bound, 2,8 args: 297 => 44
call bound, 3,2 args: 206 => 36
call unbound, 0,5 args: 9 => 9
call unbound, 0,10 args: 9 => 9
call bound, 0,5 args: 57 => 35
call bound, 0,10 args: 105 => 52
--- constructing performance ---
construct unbound, 0,0 args: 34 => 32
construct bound, 0,0 args: 62 => 53
construct bound, 2,0 args: 59 => 55
construct bound, 5,0 args: 98 => 86
construct bound, 2,3 args: 78 => 69
construct bound, 2,7 args: 299 => 77
construct bound, 3,2 args: 240 => 72
construct unbound, 0,5 args: 34 => 32
construct unbound, 0,10 args: 33 => 35
construct bound, 0,5 args: 80 => 72
construct bound, 0,10 args: 312 => 75
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → WORKSFORME
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Assignee: nobody → jdemooij
status-firefox111:
--- → wontfix
status-firefox112:
--- → fixed
status-firefox-esr102:
--- → wontfix
Target Milestone: --- → 112 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•