Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 24 lines (20 sloc) 0.584 kb
#!/usr/bin/perl -w
use strict;
use warnings;
use Benchmark;
use Math::GSL::Vector;
use Math::GSL::RNG;
use List::Util qw/max min/;
my $rng = Math::GSL::RNG->new;
my $num = shift || 10000;
my @stuff = map { $rng->get() } (1..$num);
my $vector = Math::GSL::Vector->new([@stuff]);
my $runs = shift || 50_000;
timethese($runs, {
'min - List::Util ' => sub { min(@stuff) },
'min of Math::GSL vector ' => sub { $vector->min },
});
timethese($runs, {
'max - List::Util ' => sub { max(@stuff) },
'max of Math::GSL vector ' => sub { $vector->max },
});
Jump to Line
Something went wrong with that request. Please try again.