Math.ceil(test) vs ~~test vs Math.floor(test) vs Math.floor(test) + 1 (CEIL) vs FAST CEILFastest: FAST CEIL (2.7x faster)
18,598,986 ops/sec
18,483,350 ops/sec
7,049,193 ops/sec
7,032,581 ops/sec
6,993,165 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Math.ceil(test) | |
| ~~test | |
| Math.floor(test) | |
| Math.floor(test) + 1 (CEIL) | |
| FAST CEIL |
| Test name | Executions per second |
|---|---|
| ✓ ~~test | 136,515,248 Ops/sec |
| Math.ceil(test) | 130,052,784 Ops/sec |
| FAST CEIL | 127,713,448 Ops/sec |
| Math.floor(test) + 1 (CEIL) | 126,454,824 Ops/sec |
| Math.floor(test) | 108,444,304 Ops/sec |