.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Compress::Snappy 3pm" .TH Compress::Snappy 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Compress::Snappy \- Perl interface to Google's Snappy (de)compressor .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Compress::Snappy; \& \& my $dest = compress($source); \& my $dest = decompress($source); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The \f(CW\*(C`Compress::Snappy\*(C'\fR module provides an interface to Google's Snappy (de)compressor. .PP Snappy does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger. .SH FUNCTIONS .IX Header "FUNCTIONS" .SS compress .IX Subsection "compress" .Vb 1 \& $string = compress($buffer) .Ve .PP Compresses the given buffer and returns the resulting string. The input buffer can be either a scalar or a scalar reference. .SS decompress .IX Subsection "decompress" .SS uncompress .IX Subsection "uncompress" .Vb 1 \& $string = decompress($buffer) .Ve .PP Decompresses the given buffer and returns the resulting string. The input buffer can be either a scalar or a scalar reference. .PP On error (in case of corrupted data) undef is returned. .SH PERFORMANCE .IX Header "PERFORMANCE" This distribution contains a benchmarking script which compares several compression modules available on CPAN. These are the results on a MacBook 2GHz Core 2 Duo (64\-bit) with Perl 5.14.2: .PP .Vb 7 \& Compressible data (10 KiB) \- compression \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& Compress::LZ4::compress 183794/s 1795 MiB/s 1.152% \& Compress::Snappy::compress 122496/s 1196 MiB/s 5.332% \& Compress::LZF::compress 44383/s 433 MiB/s 1.865% \& Compress::Zlib::compress 2765/s 27 MiB/s 1.201% \& Compress::Bzip2::compress 110/s 1 MiB/s 2.070% \& \& Compressible data (10 KiB) \- decompression \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& Compress::LZ4::decompress 546133/s 5333 MiB/s \& Compress::Snappy::decompress 175363/s 1713 MiB/s \& Compress::LZF::decompress 135244/s 1321 MiB/s \& Compress::Bzip2::decompress 6352/s 62 MiB/s \& Compress::Zlib::uncompress 5440/s 53 MiB/s \& \& Uncompressible data (10 KiB) \- compression \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& Compress::LZ4::compress 763738/s 7458 MiB/s 107.463% \& Compress::Snappy::compress 552269/s 5393 MiB/s 100.000% \& Compress::LZF::compress 532919/s 5204 MiB/s 101.493% \& Compress::Bzip2::compress 15424/s 151 MiB/s 185.075% \& Compress::Zlib::compress 4325/s 42 MiB/s 105.970% \& \& Uncompressible data (10 KiB) \- decompression \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& Compress::LZF::decompress 2583577/s 25230 MiB/s \& Compress::LZ4::decompress 2383127/s 23273 MiB/s \& Compress::Snappy::decompress 2068002/s 20195 MiB/s \& Compress::Bzip2::decompress 48650/s 475 MiB/s \& Compress::Zlib::uncompress 6342/s 62 MiB/s .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .PP .SH "REQUESTS AND BUGS" .IX Header "REQUESTS AND BUGS" Please report any bugs or feature requests to . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH SUPPORT .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Compress::Snappy .Ve .PP You can also look for information at: .IP \(bu 4 GitHub Source Repository .Sp .IP \(bu 4 AnnoCPAN: Annotated CPAN documentation .Sp .IP \(bu 4 CPAN Ratings .Sp .IP \(bu 4 RT: CPAN's request tracker .Sp .IP \(bu 4 Search CPAN .Sp .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2011\-2015 gray , all rights reserved. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH AUTHOR .IX Header "AUTHOR" gray,