Add an immutable rope based textbuffer#201
Merged
dannypsnl merged 8 commits intojeapostrophe:masterfrom Mar 26, 2026
Merged
Conversation
Restrict end position not exceed the line count of the textbuffer.
dannypsnl
reviewed
Mar 24, 2026
Collaborator
Author
|
This will be one of the most exciting changes.
|
Collaborator
Author
|
For performance, the benchmark result using -backend: legacy
-module: /home/lcdh/work/racket-langserver/doclib/textbuffer/editor-legacy.rkt
+backend: rope
+module: /home/lcdh/work/racket-langserver/doclib/textbuffer/editor-rope.rkt
fixture: lines=2000 width=40 chars=82000
build editor from source text
iterations: 50
-cpu: 6368 ms real: 6416.571 ms gc: 715 ms avg-real: 128331.426 us
+cpu: 18 ms real: 18.439 ms gc: 0 ms avg-real: 368.779 us
copy editor snapshot
iterations: 100
-cpu: 9424 ms real: 9498.749 ms gc: 1340 ms avg-real: 94987.488 us
+cpu: 0 ms real: 0.093 ms gc: 0 ms avg-real: 0.930 us
line/char->pos middle
iterations: 10000
-cpu: 8 ms real: 8.677 ms gc: 0 ms avg-real: 0.868 us
+cpu: 2 ms real: 2.803 ms gc: 0 ms avg-real: 0.280 us
pos->line/char middle
iterations: 10000
-cpu: 13 ms real: 13.161 ms gc: 0 ms avg-real: 1.316 us
+cpu: 2 ms real: 2.810 ms gc: 0 ms avg-real: 0.281 us
get-char middle
iterations: 100000
-cpu: 112 ms real: 113.493 ms gc: 0 ms avg-real: 1.135 us
+cpu: 12 ms real: 12.887 ms gc: 0 ms avg-real: 0.129 us
get-text full document
iterations: 200
-cpu: 658 ms real: 663.656 ms gc: 4 ms avg-real: 3318.281 us
+cpu: 102 ms real: 103.083 ms gc: 1 ms avg-real: 515.417 us
get-text middle range
iterations: 5000
-cpu: 20 ms real: 20.099 ms gc: 0 ms avg-real: 4.020 us
+cpu: 5 ms real: 5.921 ms gc: 0 ms avg-real: 1.184 us
single top-of-file insert with restore
iterations: 2000
-cpu: 228 ms real: 230.751 ms gc: 0 ms avg-real: 115.375 us
+cpu: 7 ms real: 7.542 ms gc: 0 ms avg-real: 3.771 us
single middle replacement with restore
iterations: 2000
-cpu: 501 ms real: 505.195 ms gc: 0 ms avg-real: 252.597 us
+cpu: 20 ms real: 21.138 ms gc: 0 ms avg-real: 10.569 us
small multiline replace with restore
iterations: 1000
-cpu: 343 ms real: 346.685 ms gc: 1 ms avg-real: 346.685 us
+cpu: 10 ms real: 10.841 ms gc: 0 ms avg-real: 10.841 us
typing burst of 50 inserts with restore
iterations: 100
-cpu: 363 ms real: 366.392 ms gc: 0 ms avg-real: 3663.916 us
+cpu: 16 ms real: 16.392 ms gc: 0 ms avg-real: 163.923 us |
Collaborator
Author
|
In CI, removing the GUI dependency and adding the |
dannypsnl
approved these changes
Mar 26, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR
doclib/editor.rkt.It also avoids loading
frameworkmodule, remove the requirement forxvfb-runin headless environment. And improves startup speed and memory footprint.The treelist based implementation I experimented is still too slow for big files.