coeffs in your second function is a global variable (used in the first line of that function). If I pass that through in a similar way to the first function then the timings are roughly the same for me.
— Mike On Saturday, 3 January 2015 22:12:51 UTC+2, Christoph Ortner wrote: > > Dear Tim and Viral (and others), > > The above code snippet is a slightly simplified version of my original > code, supplied with random data. I wrote two versions: one with basic > arrays and a second with custom types that contain these arrays. The result: > > > @time evalSiteFunction_without_type!(coeffs, stencil, J, Y, Frc) > > elapsed time: 0.01496518 seconds (13888 bytes allocated) > > @time evalSiteFunction!(sp, J, Y, Frc) > > elapsed time: 1.178802132 seconds (320878944 bytes allocated, 11.28% gc > time) > > Is this a bug? Or am I missing something else? I wanted to try > @code_warntype, but it seems to not exist in my Julia installation. Is it > 0.4? > > Although I can probably create a temporary workaround for this, any > further advise would be greatly appreciated. > > All the best, > Christoph > >
