Created
June 11, 2016 06:06
-
-
Save NaelsonDouglas/76a0fd3b9726724030b292c7b571d85d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Função aleatória que usa muitas operações em matrizes | |
| @acc f(x::Array{Int64}) = x .* x .+ x .* x .- x ./ x | |
| input = Int64[1:10000] | |
| print("\n Input x length: ",length(input),"\n \n") | |
| for(loop=1:10) | |
| acc = @elapsed f(input) | |
| noacc = @elapsed @noacc f(input) | |
| print("Time to perform with acc: ", acc,"\n") | |
| print("Time to perform without acc: ", noacc,"\n") | |
| if (noacc > acc) | |
| print("acc was ",noacc/acc," times faster than noacc\n") | |
| else | |
| print("nacc was ",acc/noacc," times faster than acc\n") | |
| end | |
| print("\n \n") | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment