(esprima) Esprima benchmark is slow

NEW
Unassigned

Status

()

defect
7 years ago
3 years ago

People

(Reporter: dherman, Unassigned)

Tracking

(Depends on 3 bugs)

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(4 attachments)

(Reporter)

Description

7 years ago
Esprima is a JS parser written in JS that's got pretty good performance, but we're not doing as well as we could. I'll attach a little benchmark.

Dave
(Reporter)

Comment 1

7 years ago
You can run in-browser benchmarks at the URL.

Dave
(Reporter)

Comment 2

7 years ago
Posted file esprima library
(Reporter)

Comment 3

7 years ago
Posted file sample input

Comment 5

6 years ago
Nightly - Total 359.6 ms 993.3 ms (slow script dialog) 0.0 ms 154.0 ms
Chrome 30 - Total 142.8 ms 221.2 ms 0.0 ms 49.1 ms
IE 10 - Total 217.4 ms 241.4 ms 0.0 ms 76.7 ms
Assignee: general → nobody
We are still a lot slower here. Especially with Traceur.
Nightly	    127.7 ms 367.9 ms 451.1 ms 112.0 m
Chrome 42   39.2 ms  232.5 ms 76.4 ms  50.8 ms
I'll profile this later. I bet there are some interesting perf cliffs.
Flags: needinfo?(jdemooij)
Posted file Shell version
A shell version of the benchmark. The numbers are better than in the browser and UglifyJS2 seems to be faster than V8 in the shell, but I can reproduce Traceur being about 6x slower, so this will be useful.
Depends on: 1131996
For Traceur, we have the usual suspects:

(1) About 25% under CreateThis* stubs. This is bug 1129387 and seems to affect a ton of different benchmarks lately. I want to fix this very soon.

(2) Some highly polymorphic GETPROPs. This is bug 965793, though there are alternatives to that approach, like Luke's reverse-shape idea. This is a pretty typical performance issue for scripts that build a tree and access properties of parent nodes, unfortunately.

(3) Some arguments object stuff, filed bug 1131996 and bug 1132004.
Depends on: 1129387, 965793, 1132004
Biggest problem with Esprima is that we spend 15-20% of the time under Nursery::collect, almost half of that is under Nursery::moveToTenured. Maybe our pretenuring heuristics don't work, or we're simply creating a ton of garbage.

Acorn spends about 10% under Nursery::collect. It also has some slow stuff like NewDenseArray and InitElementArray, I have to investigate this more.

(In reply to Jan de Mooij [:jandem] from comment #9)
> (1) About 25% under CreateThis* stubs. This is bug 1129387 and seems to
> affect a ton of different benchmarks lately.

Add Esprima and UglifyJS2 to the list.
Flags: needinfo?(jdemooij)

Comment 11

4 years ago
Apparently the site changed... the tests are longer and there are new ones.

Nightly 42 / Chrome 43

Esprima 2.4.1: 344.8 ms / 306.6 ms
UglifyJS2: 642.3 ms / 1097.9 ms
Traceur: 735.2 ms / 397.2 ms
Acorn 1.0.1: 523.1 ms / 323.9 ms
Shift: 1732.1 ms / 1633.6 ms
Shift (no early errors): 279.1 ms / 203.0 ms

Results are much better than before.
You need to log in before you can comment on or make changes to this bug.