Math.floor vs shift
JavaScript performance comparison
Info
Compares Math.floor(x) to (x >> 0) as a way of converting to an int. They aren't completely equivalent; note that Math.floor(NaN) is NaN, while (NaN >> 0) is 0.
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Math.floor |
|
pending… |
Shift |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by Ted Hopp
- Revision 2: published
0 comments