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

roaring-wasm

v1.1.0

Published

WebAssembly port of Roaring Bitmaps for NodeJS

Downloads

1,164

Readme

roaring-wasm

WebAssembly port of Roaring Bitmaps for Node, Browser and Deno. It is interoperable with other implementations via the Roaring format.

Roaring bitmaps are compressed bitmaps. They can be hundreds of times faster.

NOTE

This package is intended as a stripped down cross platform and broewser alternative to roaring-node, repository. If you are using just NodeJS, roaring-node is faster, has a better API that fully leverages the v8 garbage collector and the native CPU SIMD instructions, and has also asynchronous operations.

WARNING ⚠️ - breaking API changes introduced in version 1.0.0

Please update your codebase accordingly.

  • remove cardinality() method, replaced with "size" property
  • convert method isEmpty() to a property isEmpty: boolean
  • serialize and deserialize now require a format argument
  • removed RoaringUint32Array - since we have "streaming" functions now that copy chunks data in chunks between JS
  • removed some utility methods
  • removed usage of Node buffer

installation

npm install --save roaring-wasm

Try it live - https://npm.runkit.com/roaring-wasm

Code sample:

// npm install --save roaring-wasm
// create this file as demo.js
// type node demo.js or nodejs demo.js depending on your system

import { RoaringBitmap32, roaringLibraryInitialize } from "roaring-wasm";

// This is needed in browser (and in this case we are using top level await), in nodejs this is not required.
await roaringLibraryInitialize();

var bitmap1 = new RoaringBitmap32();
bitmap1.addMany([1, 2, 3, 4, 5, 100, 1000]);
console.log("bitmap1.toSet():", bitmap1.toSet());

var bitmap2 = new RoaringBitmap32();
bitmap2.addMany([3, 4, 1000]);
console.log("bitmap2.toSet():", bitmap1.toSet());

var bitmap3 = new RoaringBitmap32();
console.log("bitmap1.size:", bitmap1.size);
console.log("bitmap2.has(3):", bitmap2.has(3));

bitmap3.add(111);
bitmap3.add(544);
bitmap3.orInPlace(bitmap1);
bitmap1.optimize();
console.log(bitmap3.toString());

console.log("bitmap3.toArray():", bitmap3.toArray());
console.log("bitmap3.maximum():", bitmap3.maximum());
console.log("bitmap3.rank(100):", bitmap3.rank(100));

bitmap1.dispose();
bitmap2.dispose();
bitmap3.dispose();

Documentation

https://salvatorepreviti.github.io/roaring-wasm

References

Licenses

  • This package is provided as open source software using Apache License.

  • CRoaring is provided as open source software using Apache License.

API

See the roaring module documentation

Other

Wanna play an open source game made by the author of this library? Try Dante

Development, local building

This project requires emsdk installed and activated. See https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html.

On mac you can install emscripten with homebrew:

brew install emscripten

To download the repository:

git clone https://github.com/SalvatorePreviti/roaring-wasm.git

cd roaring-wasm

git submodule update --init --recursive

npm install

To compile and run test

npm run build

Output will be generated in the packages/roaring-wasm folder

The build system was tried on Linux and MacOSX, is not tested/maintained for other system or Windows.