-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter: deduplicate annotations before filtering
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 and of itself this is relatively harmless, but filterHighlights then maps back from annotations to highlights, and: for (var i = 0, len = filtered.length; i < len; i++) { highlights = highlights.not(filtered[i]._local.highlights); } 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 and using it in filter.js, but the same coupling exists for .data('annotation') already...
- Loading branch information
Showing
3 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters