]> git.vpit.fr Git - perl/modules/Scalar-Vec-Util.git/blobdiff - samples/bench.pl
Add a fairer 'eq' benchmark with regards to Bit::Vector
[perl/modules/Scalar-Vec-Util.git] / samples / bench.pl
index a5712308a71000451946b4d4f35c48e4df10e703..685452b7cecf1f3cb86c2d092511d8188b42cb82 100755 (executable)
@@ -3,10 +3,10 @@
 use strict;
 use warnings;
 
-use Benchmark qw/cmpthese/;
+use Benchmark qw<cmpthese>;
 
-use lib qw{blib/arch blib/lib};
-use Scalar::Vec::Util qw/vfill vcopy veq/;
+use lib qw<blib/arch blib/lib>;
+use Scalar::Vec::Util qw<vfill vcopy veq>;
 
 BEGIN {
  print 'We ';
@@ -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";