This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
Re-scan only changed region when buffer changes - #394
Merged
Merged
Conversation
maxbrunsfeld
force-pushed
the
mb-optimize-buffer-rescan
branch
from
May 22, 2015 00:59
924276b to
13c9806
Compare
17 of 20 tasks
maxbrunsfeld
force-pushed
the
mb-optimize-buffer-rescan
branch
from
May 27, 2015 21:56
13c9806 to
c98162e
Compare
Use Patch to aggregate changes between deferred scans of the buffer.
maxbrunsfeld
force-pushed
the
mb-optimize-buffer-rescan
branch
from
May 27, 2015 21:57
c98162e to
6f57aca
Compare
maxbrunsfeld
pushed a commit
that referenced
this pull request
May 27, 2015
Re-scan only changed region when buffer changes
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
Currently, whenever a buffer stops changing, we re-scan the entire buffer for strings matching our search. This can take a long time and can delay the UI responding to typing.
Here's a flame graph taken while typing in the middle of jQuery 2.0.3 (88,000) lines while searching for the string
e(20769 results). Rescanning took 681 ms.After
This new approach is to keep track of the buffer changes that occur between scans, and only rescan the changed regions.
Here's a flame graph for the same operation as above. Rescanning took 8 ms.
This uses a new (and for the time being, undocumented) feature of
text-buffer: thePatchclass that allows text changes to be aggregated and grouped (see atom/text-buffer#62).