Skip to content

Instantly share code, notes, and snippets.

@moritz
Created October 25, 2011 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritz/1312199 to your computer and use it in GitHub Desktop.
Save moritz/1312199 to your computer and use it in GitHub Desktop.
Benchmarking rakudo + mandelbrot-color on top of master (original) and green_threads
my @patched = (36.272, 36.177, 36.078, 36.229, 35.981);
my @original = (34.223, 34.061, 33.960, 33.945, 33.636);
sub avg(*@a) {
([+] @a) / @a.elems;
}
sub std(*@a) {
sqrt( (avg(@a X** 2) - avg(@a) ** 2 ) / (@a.elems - 1));
}
my $avg_p = avg @patched;
my $std_p = std @patched;
my $avg_o = avg @original;
my $std_o = std @original;
my $std = ($std_p + $std_o) / sqrt(2);
my $sigmas = abs($avg_p - $avg_o) / $std;
say "Original: $avg_o ± $std_o";
say "Patched: $avg_p ± $std_p";
printf "Patched version is %s than the original by %.2f%%, signficance %.1fσ\n",
($avg_o < $avg_p) ?? 'slower' !! 'faster',
abs($avg_o - $avg_p) / $avg_o * 100,
$sigmas;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment