This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
Add native TextBuffer implementation - #5
Merged
Merged
Conversation
nathansobo
force-pushed
the
text-buffer
branch
2 times, most recently
from
January 15, 2017 18:41
0bbafab to
ddb73a3
Compare
Merged
maxbrunsfeld
force-pushed
the
text-buffer
branch
from
January 16, 2017 18:55
ddb73a3 to
5547401
Compare
nathansobo
force-pushed
the
text-buffer
branch
5 times, most recently
from
January 20, 2017 22:59
a3f92a0 to
aa1cd98
Compare
nathansobo
force-pushed
the
text-buffer
branch
from
January 30, 2017 20:04
aa1cd98 to
47e0fe3
Compare
maxbrunsfeld
force-pushed
the
text-buffer
branch
3 times, most recently
from
February 1, 2017 20:02
93832b2 to
688ee28
Compare
nathansobo
force-pushed
the
text-buffer
branch
2 times, most recently
from
February 3, 2017 13:58
e5919b6 to
b7c3bb2
Compare
maxbrunsfeld
force-pushed
the
text-buffer
branch
from
February 4, 2017 01:15
7bbf3be to
5f56ae6
Compare
maxbrunsfeld
force-pushed
the
text-buffer
branch
2 times, most recently
from
March 11, 2017 00:40
b84275d to
fa8cd99
Compare
maxbrunsfeld
force-pushed
the
text-buffer
branch
from
March 23, 2017 00:37
e470666 to
73f2cdd
Compare
maxbrunsfeld
force-pushed
the
text-buffer
branch
3 times, most recently
from
June 8, 2017 19:26
1fd28a8 to
340e586
Compare
At least on macOS with libc++, it is like 3x faster.
Closed
1 task done
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.
Core functionality
Patch. This representation will significantly improve our memory efficiency and data locality when dealing with large files, and allow many operations likeserializeandisModifiedto perform well regardless of the file size.TextBuffer::create_snapshot(). This will allow the text of the buffer to be used in a read-only fashion in a background thread, even while mutations are going on in the main thread. We will use this to add an asynchronoussavemethod that does no copying.Text::write. This will serialize a text slice to a C++ stream in a given encoding. We will use this when saving the buffer to write each chunk of the buffer to disk.text_diffmethod that returns aPatchthat we can use to update markers correctly when the buffer's on-disk contents change. We'll use Google's diff-match-patch library for the diffing. The library has been ported to work with STL-compatible strings.searchmethod that can be used to search for a given regex pattern in either the buffer or a snapshot of the buffer. We'll use the PRCE regex library since it supports a superset of the ECMAScript regex syntax, and it can search text that is stored in a non-contiguous structure, via the partial match API.is_modifiedmethod that performs well regardless of the file size.is_modifiedwork correctly even when there are outstanding snapshots.saveand.loadOptimizations
search.stdiorather thanfstreamto maximize IO performancePatch::splicemutate nodes' existing text rather than creating new text.Integration
TextBufferTextBufferTextBuffer.saveTextBuffer.loadTextBuffer.searchAPI that we can use as an efficient for read operations that are currently slow for large files, such as checking if hard tabs are used, and checking what line endings are used.text-bufferrepo. (Use native buffer implementation from superstring text-buffer#225)TextBufferimplementation