Closed Bug 1565549 Opened 5 years ago Closed 5 years ago

Bad performance for generators (compared to Chrome)

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

66 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1317690

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.

Status: UNCONFIRMED → NEW
Depends on: 1317690
Ever confirmed: true
Product: Firefox → Core
Component: Untriaged → JavaScript Engine: JIT

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.

Status: NEW → RESOLVED
Closed: 5 years ago
No longer depends on: 1317690
Priority: -- → P3
Resolution: --- → DUPLICATE

Cool-cool, looking forward for the resolution!

You need to log in before you can comment on or make changes to this bug.