#!/usr/bin/perl use strict; use warnings; use List::Util qw( min max ); use List::MoreUtils qw( minmax ); # use Benchmark qw(:all) ; # WindowsOS use Benchmark::Forking qw( timethese cmpthese ); # UnixOS sub simpleUtil { my (@numbers) = @_; my $min = min @numbers; my $max = max @numbers; return $min, $max; } sub moreUtil { my (@numbers) = @_; my ($min, $max) = minmax @numbers; return $min, $max; } my @test_array = (3,6,7,6,3,10,5,6,2,10); my $results = timethese(1000000000, { SimpleUtil => simpleUtil(@test_array), MoreUtil => moreUtil(@test_array), }, 'none'); cmpthese( $results ); __END__ $ perl test.pl Rate 10 2 SimpleUtil 10 278551532/s -- -31% -57% 2 406504065/s 46% -- -37% SimpleUtil 645161290/s 132% 59% --