Created
June 24, 2016 10:07
-
-
Save pkofod/0a3b1ab43cd18951781dd29e9cb7f08f 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
using BenchmarkTools | |
A = rand(10000) | |
B = Vector[rand(10) for i = 1:1000] | |
C = rand(10,1000) | |
D = rand(10000) | |
E = Vector[rand(10) for i = 1:1000] | |
F = rand(10, 1000) | |
function fast!(a, c) | |
for j = 1:1000 | |
a[1+(j-1)*10:j*10] = c[1+(j-1)*10:j*10]'*rand(10,10) | |
end | |
end | |
function fast_slow!(c, f) | |
for j = 1:1000 | |
c[:, j] = f[:, j]'*rand(10,10) | |
end | |
end | |
function slow!(b, d) | |
for j = 1:1000 | |
for i = 1:10 | |
b[j][:] = d[j]'*rand(10,10) | |
end | |
end | |
end | |
fast!(A, D) | |
fast_slow!(C, F) | |
slow!(B, E) | |
@benchmark fast!(A, C) | |
@benchmark fast_slow!(C, F) | |
@benchmark slow!(B, E) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment