Created
June 6, 2014 10:31
-
-
Save tanmaykm/e878ff0fe14f6b01b6dd to your computer and use it in GitHub Desktop.
Test code for https://github.com/JuliaLang/julia/pull/7047
This file contains 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
t = m = 0 | |
for i in 1:5 | |
S = sparse(rand(10^2, 10^2)) | |
(_,ti,mi) = @timed for I in 1:size(S,1), J in 1:size(S,2) | |
S[I,J] = I | |
end | |
t += ti; m += mi | |
end | |
for i in 1:5 | |
S = speye(10^2, 10^2) | |
(_,ti,mi) = @timed for I in 1:size(S,1), J in 1:size(S,2) | |
S[I,J] = I | |
end | |
t += ti; m += mi | |
end | |
println("setindex!: elapsed time: $(t/10) seconds ($(m/10) bytes allocated)") | |
t = m = 0 | |
for i in 1:5 | |
S = speye(10^3, 10^3) | |
(_,ti,mi) = @timed diag(S); | |
t += ti; m += mi | |
end | |
for i in 1:5 | |
S = sparse(rand(10^3, 10^3)) | |
(_,ti,mi) = @timed diag(S); | |
t += ti; m += mi | |
end | |
println("diag: elapsed time: $(t/10) seconds ($(m/10) bytes allocated)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment