1Compress::LZ4(3)      User Contributed Perl Documentation     Compress::LZ4(3)
2
3
4

NAME

6       Compress::LZ4 - Perl interface to the LZ4 (de)compressor
7

SYNOPSIS

9           use Compress::LZ4;
10
11           my $compressed = compress($bytes);
12           my $decompressed = decompress($compressed);
13

DESCRIPTION

15       The "Compress::LZ4" module provides an interface to the LZ4
16       (de)compressor.
17

FUNCTIONS

19   compress
20           $compressed = compress($bytes [, $level])
21
22       Compresses the given buffer and returns the resulting bytes. The input
23       buffer can be either a scalar or a scalar reference. The default
24       acceleration level (1) can be changed, with each additional level
25       providing ~3% increase in speed; the compression level will be
26       negatively affected.
27
28   compress_hc
29           $compressed = compress_hc($bytes [, $level])
30
31       A higher-compression, but slower, version of "compress". The default
32       compression level (9) can be changed if an optional value (0-16) is
33       given.
34
35   decompress
36   uncompress
37           $bytes = decompress($compressed)
38
39       Decompresses the given buffer and returns the resulting bytes. The
40       input buffer can be either a scalar or a scalar reference.
41
42       On error (in case of corrupted data) undef is returned.
43

COMPATIBILITY

45       This library does not produce output that is compatible with the
46       official frame format. Because LZ4 did not define a container format
47       until long after it was released, many bindings, including this one,
48       prepend the original data size to the compressed data as a little-
49       endian 4-byte integer.
50
51       If you are dealing with raw data from an external source that does not
52       format the data this way, you need to use the following functions:
53
54   lz4_compress
55   lz4_compress_hc
56       Same as "compress"/"compress_hc" but does not add the length header.
57
58   lz4_decompress
59   lz4_uncompress
60           $bytes = decompress($compressed, $original_data_size)
61
62       Same as "decompress"/"uncompress" but also requires the original data
63       size to be given.
64

PERFORMANCE

66       This distribution contains a benchmarking script which compares several
67       modules available on CPAN. These are the results on a MacBook 2.6GHz
68       Core i5 (64-bit) with Perl 5.24.1:
69
70           Compressible data (10 KiB) - compression
71           ----------------------------------------
72           Compress::LZ4::compress 8   670690/s  6550 MiB/s  1.152%
73           Compress::LZ4::compress     649176/s  6340 MiB/s  1.152%
74           Compress::Snappy::compress  367492/s  3589 MiB/s  5.332%
75           Compress::LZF::compress     127765/s  1248 MiB/s  1.865%
76           Compress::LZ4::compress_hc   84620/s   826 MiB/s  1.152%
77           Compress::Zlib::compress     15514/s   152 MiB/s  1.201%
78           Compress::Bzip2::compress      246/s     2 MiB/s  2.070%
79
80           Compressible data (10 KiB) - decompression
81           ------------------------------------------
82           Compress::LZF::decompress     1262620/s  12330 MiB/s
83           Compress::LZ4::decompress      819200/s   8000 MiB/s
84           Compress::Snappy::decompress   619934/s   6054 MiB/s
85           Compress::Zlib::uncompress      65163/s    636 MiB/s
86           Compress::Bzip2::decompress     12679/s    124 MiB/s
87
88           Uncompressible data (10 KiB) - compression
89           ------------------------------------------
90           Compress::LZ4::compress 8   2102098/s  20528 MiB/s  109.231%
91           Compress::LZ4::compress     1854792/s  18113 MiB/s  109.231%
92           Compress::Snappy::compress  1619124/s  15812 MiB/s  104.615%
93           Compress::LZF::compress     1349269/s  13176 MiB/s  101.538%
94           Compress::LZ4::compress_hc    96376/s    941 MiB/s  109.231%
95           Compress::Zlib::compress      66370/s    648 MiB/s  112.308%
96           Compress::Bzip2::compress     54098/s    528 MiB/s  201.538%
97
98           Uncompressible data (10 KiB) - decompression
99           --------------------------------------------
100           Compress::LZF::decompress     5004566/s  48873 MiB/s
101           Compress::LZ4::decompress     4915199/s  48000 MiB/s
102           Compress::Snappy::decompress  4906438/s  47914 MiB/s
103           Compress::Zlib::uncompress     355071/s   3467 MiB/s
104           Compress::Bzip2::decompress    175812/s   1717 MiB/s
105

SEE ALSO

107       <http://lz4.org/>
108

REQUESTS AND BUGS

110       Please report any bugs or feature requests to
111       <http://rt.cpan.org/Public/Bug/Report.html?Queue=Compress-LZ4>.  I will
112       be notified, and then you'll automatically be notified of progress on
113       your bug as I make changes.
114

SUPPORT

116       You can find documentation for this module with the perldoc command.
117
118           perldoc Compress::LZ4
119
120       You can also look for information at:
121
122       ·   GitHub Source Repository
123
124           <https://github.com/gray/compress-lz4>
125
126       ·   AnnoCPAN: Annotated CPAN documentation
127
128           <http://annocpan.org/dist/Compress-LZ4>
129
130       ·   CPAN Ratings
131
132           <http://cpanratings.perl.org/d/Compress-LZ4>
133
134       ·   RT: CPAN's request tracker
135
136           <http://rt.cpan.org/Public/Dist/Display.html?Name=Compress-LZ4>
137
138       ·   Search CPAN
139
140           <http://search.cpan.org/dist/Compress-LZ4/>
141
143       Copyright (C) 2012-2017 gray <gray at cpan.org>, all rights reserved.
144
145       This library is free software; you can redistribute it and/or modify it
146       under the same terms as Perl itself.
147

AUTHOR

149       gray, <gray at cpan.org>
150
151
152
153perl v5.30.0                      2019-07-26                  Compress::LZ4(3)
Impressum