The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gzip::Faster - gzip and gunzip, without the fuss

SYNOPSIS

    use Gzip::Faster;
    my $gzipped = gzip ($input);
    my $roundtrip = gunzip ($gzipped);
    # $roundtrip is the same as $input

DESCRIPTION

This module compresses to and decompresses from the gzip format.

FUNCTIONS

gzip

    my $zipped = gzip ($stuff);

Compress $stuff.

gunzip

    my $stuff = gunzip ($zipped);

Uncompress $zipped. This will cause a fatal error if $zipped is not compressed.

PERFORMANCE

This section compares the performance of Gzip::Faster with IO::Compress::Gzip and IO::Uncompress::Gunzip. Here is a comparison of a round-trip:

                          Rate IO::Compress::Gzip       Gzip::Faster
    IO::Compress::Gzip  1199/s                 --               -91%
    Gzip::Faster       12800/s               968%                 --

Here is a comparison of gzip (compression) only:

                          Rate IO::Compress::Gzip       Gzip::Faster
    IO::Compress::Gzip  2355/s                 --               -87%
    Gzip::Faster       17582/s               647%                 --

Here is a comparison of gunzip (decompression) only:

                              Rate IO::Uncompress::Gunzip           Gzip::Faster
    IO::Uncompress::Gunzip  2739/s                     --                   -96%
    Gzip::Faster           67368/s                  2360%                     --

The test file is in "examples/benchmark.pl" in the distribution.

There is also a module called Compress::Raw::Zlib which offers access to zlib itself. It may offer improved performance, however I have not figured out what it does yet. Its documented way of making a gzip compressed object returns something I cannot understand so I was unable to include it in the benchmark.

BUGS

The module includes functionality to round-trip various Perl flags. I applied this to preserving Perl's "utf8" flag. However, the mechanism I used trips a browser bug in the Firefox web browser where it produces a content encoding error message. Thus this functionality is disabled.

AUTHOR, COPYRIGHT AND LICENCE

Ben Bullock <bkb@cpan.org>. Copyright (C) 2014 Ben Bullock. This software may be used, modified, distributed under the same licence as Perl itself.