Number vs. plus vs. parseInt vs. parseFloat vs. /1 vs. *1 vs. 0+ vs. 1*
JavaScript performance comparison
Preparation code
<script>
var num = '1234567890';
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Number |
|
pending… |
parseInt |
|
pending… |
parseFloat |
|
pending… |
parseInt (no extra parameter) |
|
pending… |
divide by 1 |
|
pending… |
multiply by 1 |
|
pending… |
1* |
|
pending… |
-0 |
|
pending… |
Bitwise not (~~1) |
|
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 Nyuszika7H
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 6: published by LazyJim
- Revision 7: published
- Revision 8: published
- Revision 9: published
- Revision 10: published
- Revision 13: published
- Revision 14: published
- Revision 15: published
- Revision 16: published
- Revision 17: published by Aymeric
- Revision 19: published
- Revision 20: published
0 comments