Subject: | GIF encoding is very slower on Imager 0.78+ |
Date: | Sat, 15 Jan 2011 07:23:52 +0900 |
To: | bug-Imager [...] rt.cpan.org |
From: | Tokuhiro Matsuno <tokuhirom [...] gmail.com> |
In my environment, Imager 0.78+'s GIF encoding is very slow.
This is benchmark code.
-- 8< ----------------------------------------------------------------------------------------
8< -----------------------------
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Benchmark ':all';
use Config;
use lib;
# cpanm --reinstall -nv -l lib-0.75
http://search.cpan.org/CPAN/authors/id/T/TO/TONYC/Imager-0.75.tar.gz
# cpanm --reinstall -nv -l lib-0.75
http://search.cpan.org/CPAN/authors/id/T/TO/TONYC/Imager-0.78.tar.gz
my $version = shift or die "Usage: $0 version[ benchmark-times]\n";
lib->import("lib-$version/lib/perl5/");
require Imager;
print "$^O perl $]\n";
print "Imager: $Imager::VERSION\n";
print "Imager::File::GIF: $Imager::File::GIF::VERSION\n" if
$Imager::File::GIF::VERSION;
print "\n";
my $n = shift || 1000;
timethis($n, sub {
my $img = Imager->new(xsize => 128, ysize => 128) or die;
$img->write(data => \my $out, type => 'gif');
});
-- 8< ----------------------------------------------------------------------------------------
8< -----------------------------
This is a benchmark result.
-- 8< ----------------------------------------------------------------------------------------
8< -----------------------------
% perl benchmark.pl 0.75 100
darwin perl 5.012002
Imager: 0.75
timethis 100: 0 wallclock secs ( 0.20 usr + 0.00 sys = 0.20 CPU) @
500.00/s (n=100)
(warning: too few iterations for a reliable count)
% perl benchmark.pl 0.78 100
darwin perl 5.012002
Imager: 0.78
timethis 100: 16 wallclock secs ( 9.49 usr + 0.14 sys = 9.63 CPU) @
10.38/s (n=100)
-- 8< ----------------------------------------------------------------------------------------
8< -----------------------------