-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache offset and length in document nodes #408
Conversation
7a070fe
to
30d0ca1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #408 +/- ##
==========================================
+ Coverage 87.94% 88.04% +0.09%
==========================================
Files 62 62
Lines 10364 10419 +55
==========================================
+ Hits 9115 9173 +58
+ Misses 1249 1246 -3 ☔ View full report in Codecov by Sentry. |
This change is supposed to improve the performance of editor specially when editing and having cursor. I was hoping you guys can take a look, test things out, and give feedback on it. Many thanks in advance. @maelchiotti @simonbengtsson |
Sure! Tried now both on master and on the perf branch both with and without 100k characters. In summary I didn't really observe any differences. The 100k characters did not seem to matter and the experience was the same both in master and in the perf branch. The editing experience is almost lag free when writing normally so tried spamming the keyboard as fast as I could instead and then some extreme lag is observable. Could very much be related to my persistence code however and not related to fleather editor. Attaching a video of that lag when keyboard spamming for reference. Here I have 100k characters in the editor and am using the perf branch but was about the same no matter what. Note that I stopped spamming the keyboard when I saw a visible character at the | line so all characters added after that is added by lag ie when I'm not touching the keyboard. pref_branch_100k_characters.mov |
Thank you @simonbengtsson for testing it. It's weird that you're not facing any issues with the master maybe your computer is too powerful! According to our benchmark tests we've seen ~3x improvement in average frame build time on macOS (from ~450ms to ~130ms for a frame). |
The number of paragraphs ( |
30d0ca1
to
c4a937b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Awesome performance comming in :)
@@ -254,7 +253,7 @@ | |||
} | |||
|
|||
@override | |||
int get hashCode => hash3(key, scope, value); | |||
int get hashCode => Object.hash(key, scope, value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this but it would have been nice to have it in another PR :)
@@ -155,7 +155,6 @@ final class LineNode extends ContainerNode<LeafNode> with StyledNode { | |||
@override | |||
LeafNode get defaultChild => TextNode(); | |||
|
|||
// TODO: should be able to cache length and invalidate on any child-related operation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
Fixes #244
Performance comparison with master ran locally on an M1 Mac: