Fork me on GitHub

To follow up on the last discussion. After fixing my recursion strategy, I've managed to close the gap vs. using pull v3. The size of the gap varies, but I've seen it go as high as 25% (scales with the size of the result). Though, there can be a reversal when pulling many blocks, since Datascript's pull-many is simply mapv pull, but I keep track of visited entities in that case as well. I'm mainly writing this to note that there is practically no difference between my custom entity building code and just using non-recursive pull at each iteration. So, it shouldn't be too difficult to write a fairly performant 'flat pull' – just replace the recursive bits in your pull pattern with a custom loop. I can't see how to improve my code to close the gap. The identical results between using custom and pull point to the loop, but it's fairly simple and I cannot see a way to improve it. I'm going to declare it good enough 😄