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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aldogg/sorter

v0.0.3

Published

BitMask sorters, RadixBitMask sorter, bitmasksorter, bitmask-sorter

Downloads

16

Readme

BitMask Sorters in Java Script

This project tests different ideas for sorting algorithms. One of them is a binary RadixSorter that reduces passes by using a BitMask

See the initial implementation in java for more information. [Java Version and Documentation] (https://github.com/aldo-gutierrez/bitmasksorter)

sortInt() executes the radix sort in an array of numbers that are integers in the range -2^31 ... 2^31 -1

sortNumber() executes the radix sort in an array of numbers that contains integer and floating point numbers. JavaScript's numbers are always stored as double precision floating point numbers, following the international IEEE 754 standard.

RadixBitSorter:

RadixBitSorter is a binary LSD Radix Sorter that uses the bitmask to reduce the passes of a radix sorter the max length of each set of bits is 11, but in an old machine 8 is recommended

Speed

Comparison for sorting 1 Million int elements with range from 0 to 1000 in an AMD Ryzen 7 4800H processor, node v16.13.2

| Algorithm | AVG CPU time [ms] | |-------------------------|------------------:| | Javascript sort | 207 | | RadixBitIntSorter | 12 | | RadixBitNumberSorter | 30 |

Comparison for sorting 1 Million int elements with range from 0 to 1000 Million in an AMD Ryzen 7 4800H processor, node v16.13.2

| Algorithm | AVG CPU time [ms] | |-------------------------|------------------:| | Javascript sort | 263 | | RadixBitIntSorter | 30 | | RadixBitNumberSorter | 51 |

Comparison for sorting 40 Million int elements with range from 0 to 1000 Million in an AMD Ryzen 7 4800H processor, node v16.13.2

| Algorithm | AVG CPU time [ms] | |----------------------|------------------:| | Javascript sort | 13231 | | RadixBitIntSorter | 10863 | | RadixBitNumberSorter | 5133 |

USAGE

import {sortInt} from "@aldogg/sorter";
import {sortNumber} from "@aldogg/sorter";

//sortInt can sort negative and positive integer numbers in the range -2^31 ... 2^31-1 ONLY
let array = Array.from({length: size}, () => Math.floor(Math.random() * range - range / 2));
let array = new Float32Array(); //ONLY range -2^24 ... 2^24-1
let array = new Float64Array(); //ONLY range -2^31 ... 2^31-1
let array = new Int8Array();
let array = new Int16Array();
let array = new Int32Array();
let array = new Uint8Array();
let array = new Uint16Array();
let array = new Uint32Array();  //ONLY positive intenger numbers 0 ... 2^31-1
//let array =  BigInt64Array(); //BigInt is not supported neither BigInt64

sortInt(array);

//sortNumber can sort negative and positive decimal numbers in the range supported by a Float64 IIEE 754
let arrayF = Array.from({length: size}, () => Math.random() * range - range / 2);
let arrayF = new Float32Array();
let arrayF = new Float64Array();
let arrayF = new Int8Array();
let arrayF = new Int16Array();
let arrayF = new Int32Array();
let arrayF = new Uint8Array();
let arrayF = new Uint16Array();
let arrayF = new Uint32Array();
//let array =  BigInt64Array(); //BigInt is not supported neither BigInt64

sortNumber(arrayF)


TODO

  • Make a sorter for Objects with number fields
  • Learn WebAssembly and SIMD and apply it