From: Vincent Pit Date: Tue, 23 Oct 2012 13:24:48 +0000 (-0200) Subject: Add a fairer 'eq' benchmark with regards to Bit::Vector X-Git-Tag: v0.08~16 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScalar-Vec-Util.git;a=commitdiff_plain;h=a01e5924c23d6e7deeb036e054118075575de875 Add a fairer 'eq' benchmark with regards to Bit::Vector Even for this one it's still 3 times slower when the unit is 8 bytes. --- diff --git a/samples/bench.pl b/samples/bench.pl index c899ea1..685452b 100755 --- a/samples/bench.pl +++ b/samples/bench.pl @@ -226,7 +226,16 @@ if (HAS_BV) { $bv1->Fill(); $bv2->Fill(); } -print "eq:\n"; + +print "eq, origin:\n"; +cmpthese $run, { + veq => sub { veq $x, 0, $y, 0, $n }, + veq_pp => sub { Scalar::Vec::Util::veq_pp($x, 0, $y, 0, $n) }, + (veq_bv => sub { $bv1->equal($bv2) }) x HAS_BV, +}; +print "\n"; + +print "eq, random:\n"; cmpthese $run, { veq => sub { veq $x, inc($i), $y, inc($j), len($i, $j) }, veq_pp => sub { Scalar::Vec::Util::veq_pp($x, inc($i), $y, inc($j), len($i, $j)) }, @@ -241,3 +250,4 @@ cmpthese $run, { $bv3->equal($bv4); }) x HAS_BV, }; +print "\n";