Inspired by: geohots mergesorts
- C++
- C#
- Python
- JavaScript
- PHP
- Julia
- C
- Go
- Lua
- Bash
- Java
- Cython
- Python w/ Numpy
- Rust
- Kotlin
- Generic QuickSort() function, that accepts an array/list/vector/whatever
- Sorts in place (no extra arrays)
- Prints time taken to sort the array
- Time is average of at least 1000 sortings
- Array is 1000 numbers in range (-100, 100), the same every time
- All ran on the same machine
- Pseudo-code for timing:
for 1000 times:
arr = start_array
start_timer()
quicksort(arr)
stop_timer()
Language | seconds | microseconds |
---|---|---|
C++ w/ vector | 0.0000336 | 33.6 |
C++ w/ array | 0.0000362 | 36.2 |
Julia | 0.0000367 | 36.7 |
Go | 0.0000436 | 43.6 |
C | 0.0000480 | 49 |
C# | 0.0000906 | 90.6 |
JavaScript | 0.0001384 | 138.4 |
PHP | 0.0022380 | 2238 |
Python | 0.0038240 | 3824 |