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) | 113.400ns | 100.000ns | 128.000ns |
2 | C++ (G++) | 120.000ns | 0.000ns | 1,000.000ns |
3 | C (GCC) | 125.560ns | 111.000ns | 137.000ns |
4 | C++ (Clang++) | 150.320ns | 128.000ns | 195.000ns |
5 | Kotlin (Native) | 330.480ns | 302.000ns | 372.000ns |
6 | Rust | 360.000ns | 0.000ns | 1,000.000ns |
7 | Go | 440.000ns | 0.000ns | 1,000.000ns |
8 | Java | 1,120.600ns | 1,019.000ns | 1,622.000ns |
9 | JavaScript (Node) | 3,310.800ns | 3,013.000ns | 3,824.000ns |
10 | JavaScript (Bun) | 4,005.920ns | 3,618.000ns | 5,091.000ns |
11 | Python | 7,560.000ns | 5,000.000ns | 41,000.000ns |
12 | PHP | 13,421.720ns | 11,546.000ns | 27,918.000ns |
13 | Ruby | 20,960.000ns | 9,000.000ns | 283,000.000ns |
14 | JavaScript (Deno) | 628,880.320ns | 25,092.000ns | 15,012,535.000ns |
15 | Kotlin (JVM) | 1,072,004.000ns | 381,288.000ns | 7,170,944.000ns |