latin-language-toolkit/arethusa — pull request #322 by LFDM (2014-08-13 07:48:59+00:00)
Title: Huge boost to tree performance and closing of a severe memory leak

We we're calling dagre's `Renderer` far too often, as outlined in #318. Both problematic areas described there have been closed - it was easier as expected.

There are even further improvements possible, but this is already a huge huge step forward - we're rendering the tree only when we really have to now.

Work on this also uncovered a massive memory leak: The childScopes we were opening in the `depencencyTree` directive were never destroyed. If a user was now having a long annotation session, we're he touched lots of different tokens in the process, every single token he has ever seen would still linger around. If he touched the same token twice, it would also linger around twice... Thousands of unused elements, all with watches firing, were the result of this. Memory consumption was through the roof after a while and general performance started to degrade.

These issues where foretold in #121 - with the new insights gained by this PR we can finally close #121.

The headWatches are also gone from the tree - we're using proper state eventing now, which leads to nicer code that also runs much more efficiently.

Some issues remain with the `tokenRemoved` event (cf. 2d3bf35)