Math.floor vs Math.round vs parseInt vs Bitwise
JavaScript performance comparison
Info
Rounding in all form possible
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Math.floor |
|
pending… |
Math.round |
|
pending… |
parseInt |
|
pending… |
Bitwise | |
|
pending… |
Bitwise |
|
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 Felladrin
- Revision 2: published by Batiste and last updated
- Revision 5: published by John-David Dalton and last updated
- Revision 6: published
- Revision 7: published by Paul Straw and last updated
- Revision 8: published by John-David Dalton and last updated
- Revision 9: published by Fabrizio and last updated
- Revision 10: published by runTarm
- Revision 11: published
- Revision 12: published
- Revision 13: published by Steffen Haugk
- Revision 14: published
- Revision 15: published
- Revision 16: published
- Revision 17: published
- Revision 18: published
- Revision 19: published
- Revision 20: published by Simon
- Revision 21: published by Sam
- Revision 22: published
- Revision 23: published by Michael Programs
- Revision 24: published
- Revision 25: published
- Revision 26: published by Yar
- Revision 27: published
- Revision 28: published by Yar
- Revision 30: published by dested
- Revision 31: published
- Revision 32: published
- Revision 33: published
- Revision 34: published
- Revision 35: published
- Revision 36: published
- Revision 37: published
- Revision 38: published
- Revision 39: published
- Revision 41: published
- Revision 42: published by Marco Pfeiffer
- Revision 44: published
- Revision 45: published by Jon-Carlos Rivera
- Revision 46: published by Jon-Carlos Rivera
- Revision 47: published by Philip Peterson
- Revision 48: published
- Revision 50: published
- Revision 51: published by Jon-Carlos Rivera
- Revision 52: published by Jon-Carlos Rivera
- Revision 53: published
- Revision 55: published
- Revision 56: published
- Revision 57: published by azazdeaz
- Revision 58: published by azazdeaz
- Revision 59: published
- Revision 60: published
- Revision 62: published
- Revision 63: published by Eric Teubert
- Revision 64: published
- Revision 66: published
- Revision 67: published
- Revision 68: published
- Revision 69: published
- Revision 70: published
- Revision 71: published
3 comments
What about ~~?
how about floor = Math.floor floor(...)
what about bigger than 32bits ?