Benchmarks

Mac Benchmark: Bubble Sort

Bubble Sort is one of the simplest sorting algorithms that repeatedly swaps adjacent elements if they are incorrect. This benchmark measures the time it takes to sort an array of 50 unsorted numbers. Implementation modified from GeeksForGeeks.

number algorithm

All-Time Rankings

Rank Language Average Time Best Time Worst Time
1 C (Clang) 6.660µs 6.172µs 10.768µs
2 C (GCC) 7.149µs 6.537µs 9.379µs
3 Go 9.080µs 7.000µs 25.000µs
4 GraalVM 9.772µs 3.206µs 156.381µs
5 Zig 18.720µs 13.000µs 95.000µs
6 C++ (Clang++) 19.540µs 18.198µs 27.513µs
7 C++ (G++) 23.680µs 21.000µs 37.000µs
8 Kotlin (Native) 30.487µs 23.689µs 91.976µs
9 D 64.580µs 47.900µs 206.200µs
10 Rust 100.320µs 83.000µs 194.000µs
11 PHP 201.229µs 188.329µs 285.010µs
12 Python 228.240µs 171.000µs 942.000µs
13 Java 230.476µs 148.392µs 1,834.070µs
14 JavaScript (Node) 277.127µs 239.492µs 380.540µs
15 Ruby 569.360µs 229.000µs 7,881.000µs
16 JavaScript (Bun) 19,529.756µs 335.580µs 332,418.612µs
17 JavaScript (Deno) 41,857.507µs 355.820µs 1,030,825.810µs
18 Kotlin (JVM) 57,130.329µs 1,563.780µs 1,317,558.004µs

Average Times

Median Times

Best-Case Scenario Times

Worst-Case Scenario Times