IonMonkey: Implement atom inequalities.

NEW
Unassigned

Status

()

Core
JavaScript Engine
5 years ago
3 years ago

People

(Reporter: gandalf, Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Created attachment 683731 [details]
demo html

when iterating over string and doing character comparison the JS engine is two times slower than V8.
v8 generates code for character compares. We only have one very simple optimization for ==/!=. Which checks for ptr==ptr, atoms and string length. I think optimizing this very case could be simple. Last time I tried implementing a whole string compare path everything got very ugly, because of register pressure.
The problem is that IonMonkey does not yet provide a fast path for atom inequalities (see MCompare::infer in ion/MIR.cpp), so currently the result of  charAt  returns another atom which is boxed and pushed twice to call into a VM function which unbox its operands and compare the atoms.

Note: x2 times slower does not seems too bad knowing the overhead of VM function calls, both in terms of spilling and it terms of number of instructions.
Summary: V8 is x2 faster than Spidermonkey on character comparison → IonMonkey: Implement atom inequalities.
(Assignee)

Updated

3 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.