lzjb-erlang /

Filename Size Date modified Message
1.1 KB
75 B
3.0 KB
who:   matt@genges.com
what:  erlang driver for lzjb compression (stolen from ZFS).
when:  made January 2009. published January 2009.
where: everywhere
why:   everybody can find a use for a fast compression system.

  - nil

performance: not tested for throughput yet
benchmark versus [something else]:
  not tested yet

installation: build it.  
              edit src/Makefile if erlang isn't in /usr/local/lib/erlang
              put everything in dist/ where you need it to be

% export LD_LIBRARY_PATH=./lzjb-erlang/lzjb-VER/priv/ 
% erl -pz ./lzjb-erlang/lzjb-VER/ebin/

Eshell V5.6.5  (abort with ^G)
1> application:start(lzjb).    % optional
2> lzjb:start().
3>  A = lzjb:compress(<<"some binary data to compress">>).           
4> lzjb:decompress(A).
<<"some binary data to compress">>
6> Z = lzjb:compress_term({something, [to, compress]}).
7> lzjb:decompress_term(Z).

usage [DIRECT]:  % Needs to be refined.  Too raw currently.
% export LD_LIBRARY_PATH=./lzjb-erlang/lzjb-VER/priv/ 
% erl -pz ./lzjb-erlang/lzjb-VER/ebin/

Eshell V5.6.5  (abort with ^G)
1> application:start(lzjb).    % optional
2> Port = lzjb:make_port().
3> port_command(Port, lzjb:encode_compress(<<"port data to compress">>)).
4> receive Data -> Data end.
5> {Port, {data, CompressedData}} = Data.
6> OriginalDataSize = size(<<"port data to compress">>).
7> port_command(Port, lzjb:encode_decompress(CompressedData, OriginalDataSize)).
8> receive DecompressedDataTerm -> DecompressedDataTerm end.
{#Port<0.595>,{data,<<"port data to compress">>}}
9> {Port, {data, DecompressedFoundData}} = DecompressedDataTerm.
{#Port<0.595>,{data,<<"port data to compress">>}}
10> DecompressedFoundData.
<<"port data to compress">>

  - The driver must be in your LD_LIBRARY_PATH.
  - The compressed format doesn't contain the original size of the data, so
    we include it manually as an unsigned int.
  - The maximum size of one binary to compress 4GB.
  - Only compress things needing compression.  If your data has little
    to no repetition or is less than few dozen bytes, the compression can't do 
    anything except add markers saying "this isn't compressed" which make
    your "compressed" data larger than you started with by a few bytes.
    Compress largeish text entries or large terms with repeated data.
    Don't compress a secondary index lookup of just a primary key.

  - Throughput testing.
  - Testing multithreaded (+A64) versus not (+A0) performance.
  - Add unit tests.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.