I have a function "myFunc.jl", say (in actuality, this is quite a mesh generation function). I run my program once to start with, and then time the second run:
julia> include("myFunc.jl") myFunc (generic function with 1 method) julia> myFunc(); julia> @time myFunc(); elapsed time: 2.745065871 seconds (172590300 bytes allocated, 2.18% gc time) Subsequent timings and memory allocation are then pretty consistent with this. However, if I do julia> include("myFunc.jl") myFunc (generic function with 1 method) again, and then use @time, I observe a drop in time and memory allocation as follows: julia> @time myFunc(); elapsed time: 2.431480434 seconds (116902912 bytes allocated, 1.50% gc time) I have used the TypeCheck package to try and understand what is going on here, using "whos(myFunc)" to list the names and types of all variables, and it seems to me that the first time around that many of the temporary variables created by Julia have type Any. Following the second "include", these have all resolved themselves to correspond to the types I have explicitly defined in my function (everything is defined and I do not believe there are any type inconsistencies). I understand that the first time around, these types may be uncertain, but what I do not understand is why this problem resolves itself only when I "include" my function again. Why not after the first run? Apologies for not explaining this very eloquently. Any insight here would be greatly appreciated; I feel like this is a significant problem with my understanding and, as such, is likely to keep reappearing. Many thanks