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
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 |
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
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 |