So I asked a question over at https://github.com/lindahua/Devectorize.jl/issues/48#issuecomment-146307811 and it seems that I have got something completely wrong.
It seems that the following index = rand(8000) phat = zeros(8000) phat = 1./(1+exp(-index)) binds the output of the calculation on the rhs to a _new_ vector phat, not the original vector. This really means I have misunderstood preallocation/re-using memory in Julia completely! @blakejohnson suggests that I use phat[:] = 1./1+(exp(-index)) instead. As this puts the calculations in the already preallocated vector phat. Question 1) Can I learn more about this in the documentation ? I'm having a hard time finding anything, probably because [:] is hard to use as a search phrase, and I'm not sure what concepts to search for. I often wrap my variables in a type, but this seems like an extremely bad idea in combination with devec. I have taken Blake Johnsons examples from github, and added a few https://gist.github.com/pkofod/fb6c4b8ffcca1a056363 Question 2) What is it that makes test4() and test6() run so slowly? test1() and test3() seems to perform equivalently fast. I use this kind of setup all the time, and I am surprised that this method allocates so much memory. Bad news: I've been doing Julia ALL wrong! Good news: Time to learn some more!
