Benchmark: Powers of Two
Programs that iterate through powers of two up to 2^30, through repeated multiplication.
number
math
exponentiation
All-Time Rankings
Rank | Language | Average Time | Best Time | Worst Time |
---|---|---|---|---|
1 | C (Clang) | 191.560ns | 180.000ns | 230.000ns |
2 | C++ (G++) | 208.400ns | 190.000ns | 251.000ns |
3 | C (GCC) | 223.480ns | 201.000ns | 250.000ns |
4 | C++ (Clang++) | 280.840ns | 170.000ns | 2,314.000ns |
5 | Go | 318.560ns | 260.000ns | 420.000ns |
6 | Kotlin (Native) | 486.800ns | 461.000ns | 541.000ns |
7 | Rust | 768.680ns | 671.000ns | 981.000ns |
8 | Java | 1,324.120ns | 1,122.000ns | 1,503.000ns |
9 | JavaScript (Node) | 3,616.000ns | 2,865.000ns | 4,368.000ns |
10 | JavaScript (Bun) | 4,542.600ns | 2,033.000ns | 5,300.000ns |
11 | Ruby | 7,940.920ns | 6,372.000ns | 9,859.000ns |
12 | Python | 9,716.360ns | 7,474.000ns | 29,155.000ns |
13 | PHP | 20,009.200ns | 14,027.000ns | 45,025.000ns |
14 | JavaScript (Deno) | 25,796.360ns | 15,680.000ns | 45,035.000ns |
15 | Kotlin (JVM) | 20,434,849.240ns | 460,384.000ns | 68,805,145.000ns |