Skip to content

Instantly share code, notes, and snippets.

@Whateverable
Created August 16, 2019 16: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 Whateverable/85051c7cf2fe0fab83918ba26b5c94f6 to your computer and use it in GitHub Desktop.
Save Whateverable/85051c7cf2fe0fab83918ba26b5c94f6 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 ^1_000_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 ^1_000_000 -> $a,$b,$c,$d {$s2=bar($a,$b,$c,$d)};say $s2;
¦HEAD: «Benchmark:
Timing 10 iterations of 0, 1...
3999994
3999994
3999994
3999994
3999994
3999994
3999994
3999994
3999994
3999994
0: 10.1800 wallclock secs @ 0.9823/s (n=10)
3999994
3999994
3999994
3999994
3999994
3999994
3999994
3999994
3999994
3999994
1: 30.2619 wallclock secs @ 0.3304/s (n=10)
O---O--------O------O------O
| | s/iter | 0 | 1 |
O===O========O======O======O
| 0 | 1.02 | -- | 197% |
| 1 | 3.03 | -66% | -- |
----------------------------
»
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment