Closed
Bug 587255
Opened 14 years ago
Closed 8 years ago
Make Math.random faster
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla43
People
(Reporter: dmandelin, Unassigned)
References
Details
We are currently 2x slower than JSC on this microbenchmark: function f() { for (var i = 0; i < 10000000; ++i) { Math.random(1); } } var t0 = new Date; f(); print(new Date - t0); I did the comparison again with the body of Math.random mostly commented out on both sides, and it seems we are about the same speed then. So, the difference is probably in the RNG itself. JM wanted SS win: 2 ms
Comment 1•12 years ago
|
||
Interp: 1470 TM: 1476 JM: 606 JM+TI: 582 d8: 249 About 2x slower than v8. I don't have a JSC shell available to test against.
Updated•11 years ago
|
Comment 2•11 years ago
|
||
This should depend on Bug 774364 or be closed.
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Comment 4•8 years ago
|
||
Tested with modified code. code: var n = 0; function f() { for (var i = 0; i < 100000000; ++i) { n += Math.random(); // use return value, to avoid getting optimized away } } var t0 = new Date; f(); console.log(new Date - t0); results: x86_64 Firefox 40 : 790 Firefox Nightly : 450 Chrome : 1122 (4404 on 2nd run, not sure why...) Chrome Canary : 1494 (5397) Safari : 1366 WebKit : 963 x86 Firefox 40 : 1549 Firefox Nightly : 782 I think it's fast enough :)
Flags: needinfo?(arai.unmht)
![]() |
||
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in
before you can comment on or make changes to this bug.
Description
•