Or bitwise vs Double bitwise not vs Left bitwise shift vs Math.roundFastest: Or bitwise (1.2x faster)
8,100,670 ops/sec
7,978,698 ops/sec
7,937,413 ops/sec
6,846,174 ops/sec
Fastest: Left bitwise shift (1.1x faster)
593,795,008 ops/sec
590,616,896 ops/sec
589,339,328 ops/sec
527,804,832 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Or bitwise | |
| Double bitwise not | |
| Left bitwise shift | |
| Math.round |
| Test name | Executions per second |
|---|---|
| ✓ Left bitwise shift | 473,209,088 Ops/sec |
| Or bitwise | 470,269,344 Ops/sec |
| Double bitwise not | 469,772,416 Ops/sec |
| Math.round | 469,049,664 Ops/sec |