Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
radix sort each base
radix sort base with binary number, octal number, decimal number, hexadecimal, quater of int, half of int
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
base 256 (2^8)
1K/s
base 16
392/s
base 8
177/s
base 10
132/s
base 65536 (2^16)
65/s
base 2
58/s
View exact numbers
Test name
Executions per second
✓
base 256 (2^8)
1,129 Ops/sec
base 16
392 Ops/sec
base 8
177 Ops/sec
base 10
132 Ops/sec
base 65536 (2^16)
65 Ops/sec
base 2
58 Ops/sec
Script Preparation code:
function radixSort(arr, base = 10) { const logBase = (n, base = Math.E) => Math.log(n) / Math.log(base) const getDigit = (num, i) => Math.floor(Math.abs(num) / Math.pow(base, i)) % base const digitCount = (num) => num === 0 ? 1 : Math.floor(logBase(Math.abs(num), base)) + 1 const mostDigits = (nums) => nums.reduce((ret, val) => Math.max(ret, digitCount(val)), 0) const maxDigitCount = mostDigits(arr) for (let k = 0; k < maxDigitCount; k++) { let digitBuckts = Array.from({ length: base }, () => []) for (let i = 0; i < arr.length; i++) { digitBuckts[getDigit(arr[i], k)].push(arr[i]) } arr = [].concat(...digitBuckts) } return arr } const arr = Array.from({ length: 10000 }, () => Math.floor(Math.random() * 10_000_000_000_000))
Tests:
base 2
const x = radixSort(arr, 2)
base 8
const x = radixSort(arr, 8)
base 10
const x = radixSort(arr, 10)
base 16
const x = radixSort(arr, 16)
base 256 (2^8)
const x = radixSort(arr, 256)
base 512 (2^9)
const x = radixSort(arr, 512)
base 1024 (2^10)
const x = radixSort(arr, 1024)
base 2048 (2^11)
const x = radixSort(arr, 2048)
base 4096 (2^12)
const x = radixSort(arr, 4096)
base 8192 (2^13)
const x = radixSort(arr, 8192)
base 16384 (2^14)
const x = radixSort(arr, 16384)
base 32768 (2^15)
const x = radixSort(arr, 32768)
base 65536 (2^16)
const x = radixSort(arr, 65536)