Closed Bug 780458 Opened 13 years ago Closed 10 years ago

Math.IEEEremainder makes ToInt32 slow for non-integer values

Categories

(Rhino Graveyard :: Core, defect)

head
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: anba, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1 Build ID: 20120713134347 Steps to reproduce: ScriptRuntime.toInt32() uses Math.IEEEremainder() to perform the ToInt32 conversion for non-integer values. Math.IEEEremainder() is somewhat slow compared to the code in vm/NumericConversions.h, so maybe we should just copy over the SpiderMonkey implementation to Rhino. Actual results: Micro-Benchmark: (function(r) { var s=Date.now(), r2=+r; for(var i=0;i<r2;++i) 1.1&1; return Date.now() - s })(50000000) Without patch -> ~4100ms With patch -> ~100ms
PR was merged
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.