Functions inside functions using "global" variables

You’re making a closure, which is a very acceptable thing to do (unless I misunderstand your example). Closures are preformant, except for one bug in Julia: performance of captured variables in closures · Issue #15276 · JuliaLang/julia · GitHub

There was a recent thread discussing work-arounds: Avoiding Allocations with User provided Closures

3 Likes