Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Performance improvements for initial keystrokes in Find #5303

Merged
merged 2 commits into from
Sep 26, 2013

Conversation

peterflynn
Copy link
Member

Performance improvements for Find, focused on the initial keystroke or two (when the number of results is usually very high):

  • Batch tickmark creation (saves 120ms in med-size files like FindReplace)
  • Turn off tickmark & inline highlighting when tons of search results found (saves 1+ sec in huge files like codemirror.js). We still search the full text, but that's the fast part -- it's just the per-result DOM updates that were slow.

The timing tests I ran involved typing the letter "a" in the Find field in files of varying sizes. I think in typical files we'll save 50-150 ms, which should be quite noticeable. In huge files like codemirror.js the improvement will be much more dramatic.

…r two

when the number of results is usually very high:
- Batch tickmark creation (saves 120ms in med-size files like FindReplace)
- Cut off tickmark & inline highlighting when tons of search results found
(saves ~1 sec in huge files like codemirror.js)
@ghost ghost assigned gruehle Sep 24, 2013
* Add a tickmark to the editor's tickmark track, if it's visible
* @param curEditor {!Editor}
* @param pos {!{line:Number, ch:Number}}
*/
function addTickmark(curEditor, pos) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this function be removed? It isn't called by anyone, and it could encourage people to write poorly performing code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you're right -- there's no good reason to encourage adding tickmarks one at a time

@gruehle
Copy link
Member

gruehle commented Sep 25, 2013

Initial review complete. Performance is MUCH better in large documents. I just had one question and one nit.

@peterflynn
Copy link
Member Author

@gruehle Changes pushed!

@gruehle
Copy link
Member

gruehle commented Sep 26, 2013

Looks good! Merging.

gruehle added a commit that referenced this pull request Sep 26, 2013
Performance improvements for initial keystrokes in Find
@gruehle gruehle merged commit 8e79f54 into master Sep 26, 2013
@gruehle gruehle deleted the pflynn/find-highlight-perf branch September 26, 2013 16:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants