npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

radsort

v1.0.2

Published

radix sort library in typescript

Readme

Radsort

Small radix sort library built with TypeScript for arrays of non-negative integers.

Installation

Install dependencies:

npm install radsort

Usage

Import rxsort from the package:

import { rxsort } from "radsort";

const values = [170, 45, 75, 90, 802, 24, 2, 66];
const sorted = rxsort(values);

console.log(sorted);
// [2, 24, 45, 66, 75, 90, 170, 802]

For building from source

git clone https://github.com/Saptarshi2001/Radsort.git
npm run build
npm test

Current Test Status

The test suite currently passes and covers empty inputs, sorted output, duplicate preservation, and input immutability.

Benchmarks

The repository includes a deterministic benchmark suite that compares rxsort with JavaScript's numeric Array.prototype.sort((a, b) => a - b) across input sizes, data patterns, and value ranges.

npm run benchmark
npm run benchmark:quick

Methodology

  • Every data set is generated from a deterministic seeded PRNG.
  • Random, sorted, reverse-sorted, duplicate-heavy, and small-range inputs are tested at 100, 1,000, 10,000, 50,000, 100,000, and 200,000 elements.
  • A separate test holds the array length at 50,000 and changes only the random value limit: 10, 100, 1,000, 10,000, 1 million, and 1 billion.
  • Each result is the median of seven samples after two warm-up calls. Smaller inputs run multiple sorts per sample.
  • Data generation and the fresh input copy are outside the timed section.

Windows Results

Measured on 2026-06-20 with Node.js 22.17.1 (V8 12.4), Windows 11 x64, and an Intel Core i7-13620H. Times are median milliseconds; lower is better.

| Pattern | Size | Radsort | Native sort | Faster choice | | --- | ---: | ---: | ---: | --- | | Random, values 0-999,999 | 1,000 | 0.088 | 0.134 | Radsort 1.52x | | Random, values 0-999,999 | 10,000 | 0.772 | 1.741 | Radsort 2.26x | | Random, values 0-999,999 | 100,000 | 9.961 | 22.401 | Radsort 2.25x | | Random, values 0-999,999 | 200,000 | 21.992 | 50.984 | Radsort 2.32x | | Already sorted, values 0-999,999 | 10,000 | 0.754 | 0.115 | Native 6.56x | | Already sorted, values 0-999,999 | 100,000 | 9.828 | 1.190 | Native 8.26x | | Reverse sorted, values 0-999,999 | 10,000 | 0.761 | 0.226 | Native 3.37x | | Reverse sorted, values 0-999,999 | 100,000 | 9.726 | 7.965 | Native 1.22x | | Random values 0-7 (many duplicates) | 10,000 | 0.215 | 1.135 | Radsort 5.28x | | Random values 0-7 (many duplicates) | 100,000 | 2.242 | 11.513 | Radsort 5.14x | | Random values 0-7 (many duplicates) | 200,000 | 3.979 | 24.602 | Radsort 6.18x | | Small range (0-99) | 10,000 | 0.291 | 1.497 | Radsort 5.14x | | Small range (0-99) | 100,000 | 3.675 | 16.966 | Radsort 4.62x | | Small range (0-99) | 200,000 | 7.585 | 40.283 | Radsort 5.31x |

The 50,000-element value-range sweep shows the expected cost per additional decimal digit:

| Exclusive upper bound | Radsort | Native sort | | ---: | ---: | ---: | | 100 | 2.125 ms | 8.446 ms | | 1,000 | 2.882 ms | 9.258 ms | | 10,000 | 3.261 ms | 10.288 ms | | 1,000,000 | 5.087 ms | 9.935 ms | | 1,000,000,000 | 7.347 ms | 11.877 ms |

Docker Results

The quick profile was also run in the official Node 22 Debian Bookworm Slim and Alpine images. Both containers used Docker Desktop's Linux VM and the same WSL2 6.6 kernel; this compares Linux userlands, not independent kernels or hardware. Each result below names the faster algorithm and its speed advantage.

| Input | Debian result | Alpine result | | --- | --- | --- | | 1,000 random values from 0-999,999 | Radsort 1.35x faster | Radsort 1.02x faster | | 10,000 random values from 0-999,999 | Radsort 2.13x faster | Radsort 2.03x faster | | 50,000 random values from 0-999,999 | Radsort 1.62x faster | Radsort 1.62x faster | | 50,000 already-sorted values from 0-999,999 | Native 9.09x faster | Native 7.69x faster | | 50,000 reverse-sorted values from 0-999,999 | Native 2.44x faster | Native 2.38x faster | | 50,000 random values from 0-7 | Radsort 3.62x faster | Radsort 4.47x faster | | 50,000 random values from 0-99 | Radsort 3.13x faster | Radsort 3.19x faster |

Reproduce those runs from Windows PowerShell:

docker run --rm -v "${PWD}:/app" -w /app node:22-bookworm-slim `
  node benchmarks/benchmark.mjs --quick `
  --output benchmarks/results/docker-debian-node22.json

docker run --rm -v "${PWD}:/app" -w /app node:22-alpine `
  node benchmarks/benchmark.mjs --quick `
  --output benchmarks/results/docker-alpine-node22.json

On Linux or macOS, run the equivalent commands from Bash, Zsh, or another POSIX-compatible shell:

docker run --rm -v "$(pwd):/app" -w /app node:22-bookworm-slim \
  node benchmarks/benchmark.mjs --quick \
  --output benchmarks/results/docker-debian-node22.json

docker run --rm -v "$(pwd):/app" -w /app node:22-alpine \
  node benchmarks/benchmark.mjs --quick \
  --output benchmarks/results/docker-alpine-node22.json

Raw reports are stored in benchmarks/results.

Recommended Workloads

Radsort has no runtime tuning parameters. For this implementation, its best configuration is therefore a workload with non-negative integers, unsorted input, relatively few decimal digits, and roughly 1,000 or more elements. Duplicate-heavy and small-range inputs produced the largest gains. Native sort is the better default for already sorted or reverse-sorted data and for tiny random arrays around 100 elements.