Closed
Bug 1408039
Opened 7 years ago
Closed 5 years ago
Spread ...args are 99% slower than arguments
Categories
(Core :: JavaScript Engine, defect, P2)
Core
JavaScript Engine
Tracking
()
People
(Reporter: glex.spb, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: perf, Whiteboard: [js:perf])
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 Steps to reproduce: Benchmarked these three functions: function sumArguments(a, b) { if (arguments.length !== 2) return -100; return a + b; } function sumSpreadDestructure(...args) { if (args.length !== 2) return -100; let [a, b] = args; return a + b; } function sumSpreadIndex(...args) { if (args.length !== 2) return -100; let a = args[0], b = args[1]; return a + b; } https://jsperf.com/arity-checking-spread-vs-arguments Actual results: The ...args versions are 99% slower than the arguments version in both Firefox and Nightly (Windows 10). Expected results: All three functions perform roughly the same (+- 30%). E.g. in Chrome all 3 are fast, and the ...args versions are ~15% faster than the arguments one.
Updated•7 years ago
|
Tried running the benchmark and the performance is all similar now. (Values are 1,814,783,470 / 1,802,237,367 / 1,759,341,094 respectively.)
Comment 2•5 years ago
|
||
I tried as well and got similar result.
This issue seems to be fixed now.
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
Updated•2 years ago
|
Performance Impact: --- → P3
Whiteboard: [js:perf][qf:p3] → [js:perf]
You need to log in
before you can comment on or make changes to this bug.
Description
•