From: Quim Rovira Date: Sun, 14 Aug 2016 11:27:09 +0000 (+0200) Subject: Use the decoded size to measure the throughput, same as bro tool. X-Git-Tag: 0.002~21 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=807f50a6c182d8c3b733e028821829c8ace89499;p=io-compress-brotli.git Use the decoded size to measure the throughput, same as bro tool. Now the performance make a bit more sense: [quim@ling] ~/workspace/io-compress-brotli $ time perl -Iblib/lib -Iblib/arch bin/bro-perl --input brotli/tests/testdata/alice29.txt --output /tmp/out.test --repeat 40 --quality 10 --verbose Ran 40 iterations in a total of 4.536567 seconds Brotli compression speed: 1.278882 MB/s real 0m4.586s user 0m4.484s sys 0m0.048s [quim@ling] ~/workspace/io-compress-brotli $ time brotli/bin/bro --input brotli/tests/testdata/alice29.txt --output /tmp/out.test --repeat 40 --quality 10 --verbose Brotli compression speed: 1.2328 MB/s real 0m4.759s user 0m4.704s sys 0m0.000s --- diff --git a/bin/bro-perl b/bin/bro-perl index 6aac129..ffad905 100755 --- a/bin/bro-perl +++ b/bin/bro-perl @@ -85,17 +85,16 @@ for ( 1..$REPEAT ) { $bro->window( $WINDOW ); while( read $ifh, (my $buf), $STREAM ) { $encoded = $bro->compress($buf); - $total_size += bytes::length( $encoded ); + $total_size += bytes::length( $buf ); print $ofh $encoded; } $encoded = $bro->finish(); - $total_size += bytes::length( $encoded ); print $ofh $encoded; } else { my $decoded = read_file( $ifh ); my $encoded = bro( $decoded, $QUALITY, $WINDOW ); - $total_size += bytes::length( $encoded ); + $total_size += bytes::length( $decoded ); write_file( $ofh, $encoded ); } }