#!/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 },
});
