Bad performance for generators (compared to Chrome)
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Tracking
()
People
(Reporter: nickolay8, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Steps to reproduce:
I'm benchmarking the performance & overhead of the generators functions (as I'm writing a reactive library that makes heavy use of them).
The benchmark is very simple:
const generatorFunc = function * (a) { return a + 1 }
const N = 5000
let res = 0
for (let i = 0; i < N; i++) {
res += generatorFunc(i).next().value
}
Actual results:
Then I place this benchmark to jsperf.com and observe the results in Chrome and Firefox: https://jsperf.com/generator-overhead-2
Results from my machine:
- Chrome runs with 3,684 ops / sec
- Firefox runs with 419 ops / sec
The ~9x difference (8.7 to be precise) is worth investigation I think
Expected results:
Expected is that Firefox runs the same ops/sec as Chrome, or at least 2-3 times slower. Currently it runs 9 times slower, which definitely indicates there's plenty of low hanging fruits for generators performance optimization.
![]() |
||
Updated•6 years ago
|
![]() |
||
Updated•6 years ago
|
![]() |
||
Updated•6 years ago
|
Comment 1•6 years ago
|
||
Thank you for this bug report, it is perfect!
At the moment, optimizing generator with our optimizing JIT (Bug 1317690) is on our list of task for the end of 2019.
Reporter | ||
Comment 2•6 years ago
|
||
Cool-cool, looking forward for the resolution!
Description
•