Browse files

Merge branch 'master' into small_primes

  • Loading branch information...
2 parents 3fba55c + 2183496 commit 1b8b7f73d9173e5416c0f12f75547341290fcecf @leto committed Jul 13, 2009
Showing with 18 additions and 0 deletions.
  1. +18 −0 bench/small_primes
View
18 bench/small_primes
@@ -0,0 +1,18 @@
+#!/usr/bin/perl5.10 -w
+
+use strict;
+use 5.010;
+use Math::GSL::RNG;
+use Math::Pari qw/isprime/;
+use Math::Primality qw/is_prime/;
+use Data::Dumper;
+use Benchmark;
+my $count = shift || 5000;
+
+my $rng = Math::GSL::RNG->new;
+my @small_nums = map { $_ % 1000 } $rng->get(100);
+
+timethese($count,{
+ 'is_prime' => sub { is_prime($_) for @small_nums },
+ 'isprime' => sub { isprime($_) for @small_nums },
+});

0 comments on commit 1b8b7f7

Please sign in to comment.