Closed Bug 917839 Opened 11 years ago Closed 10 years ago

Peacekeeper stringWeighted test at least 3x slower than Chrome

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: jandem, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fixed by bug 956051])

Attachments

(1 file)

Attached file Shell testcase
I'm attaching a minimal shell testcase based on http://www.peacekeeper.therichins.net/test28.html

d8:  713 ms
SM: 2402 ms

The replace and indexOf parts are faster than v8. The split calls make us slow. With the split calls commented out:

d8: 464 ms
SM: 379 ms

(Yes it's a stupid test and Ion could easily constant-fold/DCE most of it...)
Split micro-benchmark:

function f() {
    var s = "Nulla blandit congue odio. Cras rutrum nulla a est. Sed eros ligula, blandit in, aliquet id.";
    var res;
    var t = new Date;
    for (var i=0; i<1000000; i++)
	res = s.split(" ");
    print(new Date - t);
}
f();

d8:  86 ms
SM: 773 ms

If I split on a character that's not in the string, like "X":

d8: 207 ms
SM: 214 ms

It's a bit weird that this makes v8 slower. Maybe they're optimizing " " somehow, will look into this.

A GGC build doesn't help much although we're generating a ton of garbage (arrays)...
Oh this is bug 688219 of course...
Depends on: 688219
Something happened here...

Using the peacekeeper test:
Nightly - Operations per second: 949588
Chrome 33 - Operations per second: 243257
This got a lot faster in http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=8f4ecbf938cd&tochange=b9d9649e7ec0

Of note in there is http://hg.mozilla.org/mozilla-central/rev/a4dc9a0f81ed which made replace() get inlined and marked as non-effectful.  

We were already doing that with split() and indexOf().  So now we can loop-hoist all this stuff.  Not running code is a lot faster than running it!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed by bug 956051]
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: