Skip to content

Instantly share code, notes, and snippets.

@Whateverable
Created June 3, 2017 19:43
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/bf49f3d01f0d955770404ad6a2396f3d to your computer and use it in GitHub Desktop.
Save Whateverable/bf49f3d01f0d955770404ad6a2396f3d to your computer and use it in GitHub Desktop.
benchable6
compare HEAD sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1000); ||| m: sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v.ASSIGN-POS($i%3, @v.AT-POS(($i+1)%3) + @v.AT-POS(($i+2)%3)) }; @v[0] }; say fib(100);
¦HEAD: «Benchmark:
Timing 10 iterations of 0, 1...
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
0: 0.0486 wallclock secs @ 205.8720/s (n=10)
(warning: too few iterations for a reliable count)
354224848179261915075
354224848179261915075
354224848179261915075
354224848179261915075
354224848179261915075
354224848179261915075
354224848179261915075
354224848179261915075
354224848179261915075
354224848179261915075
1: 0.0067 wallclock secs @ 1499.6391/s (n=10)
(warning: too few iterations for a reliable count)
O---O--------O------O------O
| | Rate | 1 | 0 |
O===O========O======O======O
| 1 | 1500/s | -- | 628% |
| 0 | 206/s | -86% | -- |
----------------------------»
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment