All Projects → lemire → FastIntegerCompression.js

lemire / FastIntegerCompression.js

Licence: Apache-2.0 license
Fast integer compression library in JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to FastIntegerCompression.js

Oroch
A C++ library for integer array compression
Stars: ✭ 22 (-52.17%)
Mutual labels:  compression, integer-compression
FrameOfReference
C++ library to pack and unpack vectors of integers having a small range of values using a technique called Frame of Reference
Stars: ✭ 36 (-21.74%)
Mutual labels:  compression, integer-compression
VTEnc
VTEnc C library
Stars: ✭ 31 (-32.61%)
Mutual labels:  compression, integer-compression
Huffman-Coding
A C++ compression program based on Huffman's lossless compression algorithm and decoder.
Stars: ✭ 81 (+76.09%)
Mutual labels:  compression
GenuineChannels
Collection of custom .NET Remoting channels
Stars: ✭ 29 (-36.96%)
Mutual labels:  compression
levi-db
levi-db is a fast database engine
Stars: ✭ 37 (-19.57%)
Mutual labels:  compression
ZipArchive
A single-class pure VB6 library for zip with ASM speed
Stars: ✭ 38 (-17.39%)
Mutual labels:  compression
Precomp Cpp
Precomp, C++ version - further compress already compressed files
Stars: ✭ 250 (+443.48%)
Mutual labels:  compression
xcdat
Fast compressed trie dictionary library
Stars: ✭ 51 (+10.87%)
Mutual labels:  compression
wordpress-plugin
Speed up your WordPress website. Optimize your JPEG and PNG images automatically with TinyPNG.
Stars: ✭ 78 (+69.57%)
Mutual labels:  compression
php-closure-compiler
A PHP Library to use Google Closure Compiler compress Javascript
Stars: ✭ 20 (-56.52%)
Mutual labels:  compression
pybashutils
Collection of Bash and Python scripts I've made that may be generally useful
Stars: ✭ 26 (-43.48%)
Mutual labels:  compression
Compressor
An android image compression library.
Stars: ✭ 6,745 (+14563.04%)
Mutual labels:  compression
ConvectionKernels
Fast, high-quality texture compression library for many formats
Stars: ✭ 40 (-13.04%)
Mutual labels:  compression
RC-PyTorch
PyTorch code for the CVPR'20 paper "Learning Better Lossless Compression Using Lossy Compression"
Stars: ✭ 44 (-4.35%)
Mutual labels:  compression
em inflate
Fast, small, in-memory inflate (zlib, deflate and gzip decompression)
Stars: ✭ 59 (+28.26%)
Mutual labels:  compression
Turbo-Transpose
Transpose: SIMD Integer+Floating Point Compression Filter
Stars: ✭ 50 (+8.7%)
Mutual labels:  compression
Guetzling
Guetzling is a simple script for macOS and Linux written in Bash, to automate (recursively finding files) the compression of jpegs using the Guetzli algorithm.
Stars: ✭ 20 (-56.52%)
Mutual labels:  compression
snappy
Fastest Snappy compression library in Node.js
Stars: ✭ 110 (+139.13%)
Mutual labels:  compression
ruby-xz
Ruby bindings for liblzma, using fiddle
Stars: ✭ 33 (-28.26%)
Mutual labels:  compression

FastIntegerCompression

Build Status

This is an integer compression library in JavaScript, useful for work on indexes. Given an array of small integers, it produces an ArrayBuffer that uses far fewer bytes than the original (using VByte compression). It assumes a modern JavaScript engine with typed arrays.

From the compressed data, you can later recover the original array quickly (at a rate of millions of integers per second).

   // var FastIntegerCompression = require("fastintcompression");// if you use node
   var array = [10,100000,65999,10,10,0,1,1,2000,0xFFFFFFFF];
   var buf = FastIntegerCompression.compress(array);
   var back = FastIntegerCompression.uncompress(buf); // gets back [10,100000,65999,10,10,0,1,1,2000]

By default, non-negative 32-bit integers are expected. If you have signed (negative and positive) 32-bit integers, then you must use distinct functions since we need to code the sign bit:

   // var FastIntegerCompression = require("fastintcompression");// if you use node
   var array = [10,100000,65999,10,10,0,-1,-1,-2000];
   var buf = FastIntegerCompression.compressSigned(array);
   var back = FastIntegerCompression.uncompressSigned(buf); // gets back [10,100000,65999,10,10,0,-1,-1,-2000]

You can install the library under node with the command line

   npm install fastintcompression

This code is made available under the Apache License 2.0.

Suitability

This library is meant to compress arrays of small integers. It is not meant to compress text documents or arrays of large (or random) integers.

Performance numbers

Go to benchmark repository (check the README.md file) and run the benchmark:

$ node test.js
Platform: linux 3.13.0-91-generic x64
Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Node version 4.5.0, v8 version 4.5.103.37

input size: 7.813K compressed size: 1000B
FastIntegerCompression.compress x 337,845 ops/sec ±0.93% (92 runs sampled)
Fastest is FastIntegerCompression.compress
FastIntegerCompression.uncompress x 187,694 ops/sec ±0.72% (93 runs sampled)
Fastest is FastIntegerCompression.uncompress

These numbers means that we can uncompress 187,694 1000-integer arrays per second. That's 187 millions of integers per second.

You might also like...

If you like this library, you might also like

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].