I’m sorry for the not very descriptive title but I couldn’t find a better way to phrase it
I have two similar programmes with a huge difference in performance
let function useless() end @time let s = 0 for n in 1:100000 s += n^10 end s end end
let @time let s = 0 for n in 1:100000 s += n^10 end s end end
The first gives me
0.221958 seconds (498.22 k allocations: 9.129 MiB, 3.08% gc time, 1.90% compilation time) and the second fives me
The difference in performance is the same as when using global variables where normally everything is hard scoped with the
So what is the source of the problem and how to avoid this situation ?