Skip to content

Instantly share code, notes, and snippets.

@Whateverable
Created August 16, 2019 16:25
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 Whateverable/0e4acc92e80490b6ee2b5827093f08b4 to your computer and use it in GitHub Desktop.
Save Whateverable/0e4acc92e80490b6ee2b5827093f08b4 to your computer and use it in GitHub Desktop.
benchable6
compare HEAD sub foo($a,$b,$c,$d){my $e=$a;my $f=$b;my $g=$c;my $h=$d;$e++;$f++;$g++;$h++;$e+$f+$g+$h};my $s1=0; for ^500_000 -> $a,$b,$c,$d {$s1=foo($a,$b,$c,$d)}; say $s1; ||| sub bar($a is copy,$b is copy,$c is copy,$d is copy) {$a++;$b++;$c++;$d++;$a+$b+$c+$d};my $s2=0; for ^500_000 -> $a,$b,$c,$d {$s2=bar($a,$b,$c,$d)};say $s2;
¦HEAD: «Benchmark:
Timing 10 iterations of 0, 1...
1999994
1999994
1999994
1999994
1999994
1999994
1999994
1999994
1999994
1999994
0: 5.4206 wallclock secs @ 1.8448/s (n=10)
1999994
1999994
1999994
1999994
1999994
1999994
1999994
1999994
1999994
1999994
1: 15.2750 wallclock secs @ 0.6547/s (n=10)
O---O--------O------O------O
| | s/iter | 1 | 0 |
O===O========O======O======O
| 1 | 1.53 | -- | -65% |
| 0 | 0.542 | 182% | -- |
----------------------------
»
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment