Closed robertknight closed 3 years ago
Another and much worse instance of this was reported today by @jeremydean on https://www.nap.edu/read/9853/chapter/3 where the public channel as ~350 annotations. At a quick glance, it looks like many of the orphans might be from other chapters of the same book (?).
Just in case the annotations change in future, I've posted a dump of them at https://gist.github.com/robertknight/108ba6ae921ad567040ac0ef637f94f5
I've been doing some work on improving how fuzzy string matching works in the dom-anchor-text-quote lib, which could be of use here. This is a profile from the current diff-match-patch based quote anchoring:
Here is the profile from a version of dom-anchor-text-quote using a new approx string matching lib:
I've re-verified that performance on https://www.nap.edu/read/9853/chapter/3 with the current production extension is unacceptable. Once anchoring is complete, the sidebar is responsive and scrolling is smooth, but the anchoring process is painful.
Fixed by https://github.com/hypothesis/client/pull/2814 (client release >= v1.617.0).
Steps to reproduce
Actual behaviour
The browser hangs for several seconds after annotations are fetched and before they are identified as Orphans. Firefox' profiler shows a large amount of time being spent in diff-match-patch's fuzzy string search.
Additional details
Tested with Hypothesis v0.51 on Firefox 53, Chrome 57.