Refactoring the parse_branch method to speed up update_positions
Refactoring the parse_branch method to speed up update_positions

For something as simple as updating positions, there's no need to instantiate
an AR object. Closer to direct SQL works best here, and speeds up the whole
update_positions action by at least an order of magnitude.

This also seems to help with a infrequent bug where update_positiions with
a tree raises a `stack level too deep` error, in part because the AR objects
are being over-instantiated.

kritik/portfolio,kritik/portfolio