add new comparison method rgb_difference that resembles arithmetical difference per...
[imager.git] / bench / transbench.perl
1 #!perl -w
2 use Imager;
3 use Benchmark;
4
5 $img = Imager->new();
6 $img->open(file=>'testimg/penguin-base.jpg', type=>'jpeg')
7         || die "Cannot open penguin-base.jpg";
8
9 timethese(-10,
10         { old=><<'EOS',
11 $im2 = $img->transform(xexpr=>'x', yexpr=>'y+10*sin((x+y)/10)');
12 EOS
13         new=><<'EOS'
14 $im2 = Imager::transform2({rpnexpr=>'x y 10 x y + 10 / sin * + getp1'}, $img);
15 EOS
16 }
17 );
18 timethese(-10,
19         { old=><<'EOS',
20 $im2 = $img->transform(xexpr=>'x', yexpr=>'y+(x+y)/10');
21 EOS
22         new=><<'EOS'
23 $im2 = Imager::transform2({rpnexpr=>'x y x y + 10 / + getp1'}, $img);
24 EOS
25 }
26 );
27