Implement total_branch_length using numpy ops? #1794
Labels
Performance
This issue addresses performance, either runtime or memory
Python API
Issue is about the Python API
After #1704 lands we can implement total_branch_length like this:
I'm sure this'll be faster most of the time, but I guess there could be some cases where overhead of creating the
time
array leads to a regression. There'll be a bit of memory overhead too, but I doubt this is significant.Any thoughts on whether we should/shouldn't do things like this?
(In retrospect this should have been a function rather than a property, as it would have been more useful (you could specify the root node you wanted to sum from), and it also violates the "properties are inexpensive" rule. I think my reasoning at the time was that this was something we should be able to keep track of efficiently incrementally, but this isn't actually true under the current definition, which only sums branch length reachable from roots. That ship has sailed anyway, but I guess we should make a note of this in the comments if/when we're updating the method)
The text was updated successfully, but these errors were encountered: