Hi, I'm trying to speed up some code and have found something curious that I can't quite understand from the "performance tips" section.
I understand that I shouldn't time my code on the first run because that will include compilation time and so forth. The odd thing that I can't understand is that there seems to be a lot of overhead every time I pass an new argument to my function. So, e.g., # Create two instances of type test test1 = test() test2 = test() # Run to get in cache - slow (as expected) foo!(test1) # Run again - fast (as expected) foo!(test1) # Run on test2 - Slow (not expected. should be fast because foo!() in cache?) @time foo!(test2) # Run on test2 again - fast (??) @time foo!(test2) I have used @code_warntype to try to get rid of type instability in my code to no avail. I know that the main bottleneck in my code is a triple-nested loop over large arrays. I recognize that my pseudo-example is kind of vague but thought I'd try this first in case this sort of behavior is indicative of a basic issue that I've overlooked. I can provide my full code if that would be helpful. Thanks in advance!