Faster filtering with fragmented annotations #526
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Let me know if you'd prefer monolithic pull requests! The test data I'm looking at for this PR is here – you'll need to open it from
tools/serve
. The key commit message here:If there are many spans of text for an annotation (many table cells,
say), previously the filter would be applied once for each span, and
matching annotations would appear n times in
filter.annotations
. In andof itself this is relatively harmless, but
filterHighlights
then mapsback from annotations to highlights, and:
is ruinous. This change dramatically improves filtering performance on
my pet test case of big, overlapping highlights on a 5000×3 table.
I have mixed feelings about using a new identifier in
_local
for this,but we don't have any guarantee that the id provided by the server is
unique, or even present.
I also have mixed feelings about setting the id in
highlighter.js
andusing it in
filter.js
, but the same coupling exists for.data('annotation')
already...