]> git.vpit.fr Git - perl/modules/Scalar-Vec-Util.git/commitdiff
Add a fairer 'eq' benchmark with regards to Bit::Vector
authorVincent Pit <vince@profvince.com>
Tue, 23 Oct 2012 13:24:48 +0000 (11:24 -0200)
committerVincent Pit <vince@profvince.com>
Tue, 23 Oct 2012 13:24:48 +0000 (11:24 -0200)
Even for this one it's still 3 times slower when the unit is 8 bytes.

samples/bench.pl

index c899ea11f4981060accfedd3d5f9af48d37d5d76..685452b7cecf1f3cb86c2d092511d8188b42cb82 100755 (executable)
@@ -226,7 +226,16 @@ if (HAS_BV) {
  $bv1->Fill();
  $bv2->Fill();
 }
  $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)) },
 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,
 };
    $bv3->equal($bv4);
   }) x HAS_BV,
 };
+print "\n";