v == 0 ? 1 : 0
JavaScript performance comparison
Info
http://stackoverflow.com/questions/6911235/javascript-is-there-a-better-way-of-writing-v-v-0-1-0
Preparation code
<script>
var v = 1;
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
v == 0 ? 1 : 0 |
|
pending… |
1 - v |
|
pending… |
v = +!v |
|
pending… |
v ^= 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
- Revision 2: published by Andreas Göbel
- Revision 3: published
- Revision 4: published
- Revision 5: published by Felix Saparelli
- Revision 6: published
- Revision 7: published
- Revision 8: published
- Revision 10: published
- Revision 11: published
- Revision 12: published
- Revision 13: published
- Revision 14: published by imsky
- Revision 15: published by Nathanael Abbotts
- Revision 16: published
0 comments