Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Chang slycoder

View GitHub Profile
@slycoder
slycoder / gist:8150548
Created Dec 27, 2013
Closure speeds: Result: 0.5260329246520996 0.656851053237915 0.5118138790130615
View gist:8150548
begin
local y::Vector{Int64} = zeros(Int64, 1000000)
global demo2
function demo2()
x = y
for ii in 1:1000000
@inbounds x[ii] += 3
end
return x
end
@slycoder
slycoder / gist:8143200
Last active Jan 1, 2016
Better example. I understand macros now I think.
View gist:8143200
macro singleton(ex)
v = eval(ex)
:($v)
end
function demo()
y = @singleton zeros(Int64, 1000000)
for ii in 1:1000000
@inbounds y[ii] += 3
end