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

tsrt

v1.1.5

Published

tsrt is a command line implementation of multiple sorting algorithms in TypeScript.

Readme

tsrt

tsrt is a command line implementation of multiple sorting algorithms in TypeScript available on npm.

Installation

npm install -g tsrt # you might have to use sudo, depending on your system
# check if the installation was successful
tsrt --version
tsrt -i 3,1,2,5,4

Check out the Examples and Options sections for more information on how to use tsrt.

Options

| Option | Description | |----------------------|-----------------------------------------------------------------------------| | -v, --version | Outputs the current version | | -a, --algorithm | The algorithm to use for sorting (see --info for available algorithms) | | -f, --file | A file to read the input from (conflicts with -i) | | -i, --input | A comma separated list of elements to sort (conflicts with -f) | | -o, --output | The file to write the sorted output | | -b, --benchmark | Benchmark the selected (-a) algorithm, or all algorithms if none is selected | | --info | Output available algorithms |

Additional options for benchmarking can be found in the Examples/Benchmarking section.

Examples

General Usage

Directly sorting a comma separated list of elements:

$ tsrt -i 3,1,2,5,4

Sorting with a specific algorithm:

$ tsrt -i 3,1,2,5,4 -a heap

Sorting a file:

$ tsrt -f path/to/file.txt

Outputting to a file:

$ tsrt -i 3,1,2,5,4 -o path/to/output.txt

Benchmarking

Benchmarking a sorting algorithm:

$ tsrt -b -a heap
to benchmark all algorithms, omit the -a flag.

Additional options:

  • --benchmark-size to specify the element count for the benchmark (default: 10000)
  • --benchmark-iterations to specify the number of iterations for the benchmark per algorithm (default: 15)

Algorithms

$ tsrt -b --benchmark-size 100000 --benchmark-iterations 100

| Algorithm | Average (ms) | Min (ms) | Max (ms) | Median (ms) | Std Dev (ms) | Range (ms) | ms/element | |-----------|--------------|----------|----------|-------------|--------------|------------|--------------| | quick | 24.693 | 12.074 | 207.11 | 21.509 | 22.811 | 195.04 | 0.00024693 | | comb | 32.323 | 18.202 | 64.786 | 30.486 | 9.4238 | 46.584 | 0.00032323 | | shell | 40.369 | 32.093 | 75.934 | 38.967 | 7.3514 | 43.840 | 0.00040369 | | radix | 45.511 | 35.089 | 74.952 | 44.374 | 6.6069 | 39.863 | 0.00045511 | | heap | 51.216 | 36.055 | 211.79 | 46.513 | 21.530 | 175.73 | 0.00051216 | | block | 92.013 | 30.695 | 237.84 | 93.372 | 29.181 | 207.14 | 0.00092013 | | merge | 125.37 | 112.68 | 167.63 | 123.91 | 9.0280 | 54.947 | 0.0012537 |

$ tsrt --info

| Name | Complexity | Memory Usage | Stable | In Place | |--------------|--------------|--------------|--------|----------| | Block sort | O(n log n) | O(n) | true | true | | Comb sort | O(n^2) | O(n) | false | true | | Heap sort | O(n log n) | O(1) | false | true | | Merge sort | O(n log n) | O(n) | true | false | | Quicksort | O(n log n) | O(log n) | false | true | | Radix sort | O(n) | O(n) | true | false | | Shellsort | O(n^(4/3)) | O(1) | false | true |

Local development & testing

# clone the repository
gh repo clone TetieWasTaken/tsrt
# or
git clone https://github.com/TetieWasTaken/tsrt.git
# install dependencies
npm install

Using npx tsx

# to run
npx tsx src/cli.ts -v
# to test
npx tsx test.ts

Using tsc & node

# to build
npm run build
# to run
node build/cli.js -v
tests are not available via tsc.

License & Disclaimer

I cannot guarantee the correctness of the algorithms implemented in this project. Use at your own risk.

I do not own any of the algorithms implemented in this project. The algorithms are based on pseudocode and are aided by online resources and AI tools.

CLI implementation is provided by commander.js.