1Compress::Snappy(3) User Contributed Perl Documentation Compress::Snappy(3)
2
3
4
6 Compress::Snappy - Perl interface to Google's Snappy (de)compressor
7
9 use Compress::Snappy;
10
11 my $dest = compress($source);
12 my $dest = decompress($source);
13
15 The "Compress::Snappy" module provides an interface to Google's Snappy
16 (de)compressor.
17
18 Snappy does not aim for maximum compression, or compatibility with any
19 other compression library; instead, it aims for very high speeds and
20 reasonable compression. For instance, compared to the fastest mode of
21 zlib, Snappy is an order of magnitude faster for most inputs, but the
22 resulting compressed files are anywhere from 20% to 100% bigger.
23
25 compress
26 $string = compress($buffer)
27
28 Compresses the given buffer and returns the resulting string. The input
29 buffer can be either a scalar or a scalar reference.
30
31 decompress
32 uncompress
33 $string = decompress($buffer)
34
35 Decompresses the given buffer and returns the resulting string. The
36 input buffer can be either a scalar or a scalar reference.
37
38 On error (in case of corrupted data) undef is returned.
39
41 This distribution contains a benchmarking script which compares several
42 compression modules available on CPAN. These are the results on a
43 MacBook 2GHz Core 2 Duo (64-bit) with Perl 5.14.2:
44
45 Compressible data (10 KiB) - compression
46 ----------------------------------------
47 Compress::LZ4::compress 183794/s 1795 MiB/s 1.152%
48 Compress::Snappy::compress 122496/s 1196 MiB/s 5.332%
49 Compress::LZF::compress 44383/s 433 MiB/s 1.865%
50 Compress::Zlib::compress 2765/s 27 MiB/s 1.201%
51 Compress::Bzip2::compress 110/s 1 MiB/s 2.070%
52
53 Compressible data (10 KiB) - decompression
54 ------------------------------------------
55 Compress::LZ4::decompress 546133/s 5333 MiB/s
56 Compress::Snappy::decompress 175363/s 1713 MiB/s
57 Compress::LZF::decompress 135244/s 1321 MiB/s
58 Compress::Bzip2::decompress 6352/s 62 MiB/s
59 Compress::Zlib::uncompress 5440/s 53 MiB/s
60
61 Uncompressible data (10 KiB) - compression
62 ------------------------------------------
63 Compress::LZ4::compress 763738/s 7458 MiB/s 107.463%
64 Compress::Snappy::compress 552269/s 5393 MiB/s 100.000%
65 Compress::LZF::compress 532919/s 5204 MiB/s 101.493%
66 Compress::Bzip2::compress 15424/s 151 MiB/s 185.075%
67 Compress::Zlib::compress 4325/s 42 MiB/s 105.970%
68
69 Uncompressible data (10 KiB) - decompression
70 --------------------------------------------
71 Compress::LZF::decompress 2583577/s 25230 MiB/s
72 Compress::LZ4::decompress 2383127/s 23273 MiB/s
73 Compress::Snappy::decompress 2068002/s 20195 MiB/s
74 Compress::Bzip2::decompress 48650/s 475 MiB/s
75 Compress::Zlib::uncompress 6342/s 62 MiB/s
76
78 <http://code.google.com/p/snappy/>
79
80 <https://github.com/zeevt/csnappy>
81
83 Please report any bugs or feature requests to
84 <http://rt.cpan.org/Public/Bug/Report.html?Queue=Compress-Snappy>. I
85 will be notified, and then you'll automatically be notified of progress
86 on your bug as I make changes.
87
89 You can find documentation for this module with the perldoc command.
90
91 perldoc Compress::Snappy
92
93 You can also look for information at:
94
95 · GitHub Source Repository
96
97 <http://github.com/gray/compress-snappy>
98
99 · AnnoCPAN: Annotated CPAN documentation
100
101 <http://annocpan.org/dist/Compress-Snappy>
102
103 · CPAN Ratings
104
105 <http://cpanratings.perl.org/d/Compress-Snappy>
106
107 · RT: CPAN's request tracker
108
109 <http://rt.cpan.org/Public/Dist/Display.html?Name=Compress-Snappy>
110
111 · Search CPAN
112
113 <http://search.cpan.org/dist/Compress-Snappy/>
114
116 Copyright (C) 2011-2015 gray <gray at cpan.org>, all rights reserved.
117
118 This library is free software; you can redistribute it and/or modify it
119 under the same terms as Perl itself.
120
122 gray, <gray at cpan.org>
123
124
125
126perl v5.30.0 2019-07-26 Compress::Snappy(3)