# 0.091843 seconds
# 0.003385 seconds
test2 is faster 30 times than test1. But in my view, test2 generate a new function each time in the loop, the new function needs time to be compiled, it should be slower than test1.
I suspect that you will see different timings if you put your tests inside functions or, if you stay in the global scope, use
const gg = mm(10).
@time begin ... end, this block is still in global, I thought it is in local scope.
Thank you so much.
Maybe this is a cultural thing, but I would warn against grouping digits like that.
1000_0000 == 10_000_000, but instinctively most of us (I suspect) will read the former as
This is a good point. I can see why someone would think
begin ... end is local, but it is (I think) the only of the three similar constructs that remains global in this situation, both
do ... end and
let ... end introduce a local scope.