GithubHelp home page GithubHelp logo

ejdaly / jslzjb-k Goto Github PK

View Code? Open in Web Editor NEW

This project forked from copy/jslzjb-k

0.0 2.0 0.0 6 KB

Fast compression for JavaScript (browser and node)

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

jslzjb-k's Introduction

jslzjb-k

This is a fork of the jslzjb project, https://code.google.com/p/jslzjb/

It has been modified to work on Uint8Array values exclusively and avoids all allocations during compression and decompression. These changes have been made out of the need to compress large buffers in a reasonable amount of time.

It performs compression of a 100 MB buffer in the order of a second.

Test it yourself:

% ./test-lzjb.js test-lzjb.js
compress: 0.822ms
decompress: 0.281ms
compressed test-lzjb.js from=905 to=659
% ./test-lzjb.js /bin/node
compress: 106.155ms
decompress: 55.874ms
compressed /bin/node from=14059k to=9348k

Two methods are exported:

/**
  * Compress byte array using fast and efficient algorithm.
  *
  * @param {Uint8Array} sstart  The buffer to compress
  * @param {Uint8Array} dstart  The buffer to write into
  * @return {number} compressed length (number of bytes written to the
  *                  output buffer). May be bigger than the size of the
  *                  output buffer, in which case some bytes are lost
  */
jslzjb.compress = function(sstart, dstart)

/**
 * Decompress byte array using fast and efficient algorithm.
 *
 * @param {Uint8Array} sstart  The buffer to decompress
 * @param {number} slen  compressed length
 * @param {Uint8Array} dstart  The buffer to write into
 * @return {number} decompressed length
 */
jslzjb.decompress = function(sstart, slen, dstart)

TODO

  • Benchmarks
  • Make use of asm.js
  • Make use of simd

jslzjb-k's People

Contributors

copy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.