Yes the algorithm I'm testing this on is fairly polished at this point, all variables are within a type and they all have strict type declarations. The memory allocations are very low compared to the vectorized code, so memory-wise the loops are doing their job, but this doesn't translate into speed-ups.
On Thursday, May 12, 2016 at 6:46:32 AM UTC-7, Steven G. Johnson wrote: > > > > On Thursday, May 12, 2016 at 8:51:44 AM UTC-4, Miguel Bazdresch wrote: >> >> honestly I've been testing out different devectorizations of my >>> algorithms and I keep getting slower results, not faster, so either I >>> really suck at writing for loops or Julia is doing a good job with my >>> vectorized code. >>> >> > Make sure your loops are in a function — don't benchmark in global scope > (see the performance tips sections of the manual). Try running your > function through @code_warntype myfunction(args...) and see if it warns > marks any variables as type "ANY" (which indicates a type instability in > your code, see the performance tips), > > Also, if you do "@time myfunc(args...)" and it indicates that you did a > huge number of allocations, you could either have a type instability or be > allocating new arrays in your inner loops (it is always better to allocate > arrays once outside your inner loops and then update them in-place as > needed). >
