There is at least 10 times in the code where we call treeProxy.drift(0.0...) when we just want to get the particles into tree order. This involves an unnecessary pass over the particles, a reduction, and a broadcast. I suggest adding a new entry method that performs the core of TreePiece::assignKeys(). Note that it must assume that nobody has messed with TreePieces::boundingBox, but I don't think that is an issue.
There is at least 10 times in the code where we call treeProxy.drift(0.0...) when we just want to get the particles into tree order. This involves an unnecessary pass over the particles, a reduction, and a broadcast. I suggest adding a new entry method that performs the core of TreePiece::assignKeys(). Note that it must assume that nobody has messed with TreePieces::boundingBox, but I don't think that is an issue.