-
Notifications
You must be signed in to change notification settings - Fork 8
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
General performance improvements #8
base: master
Are you sure you want to change the base?
Conversation
Benchmarks for folding Before:
After:
|
The motivation for lines should be obvious with this:
|
src/Yi/Rope.hs
Outdated
go x = case viewl x of | ||
EmptyL -> False | ||
Chunk _ t :< ts -> TX.any p t || go ts | ||
any p = Prelude.any (==True) . fmap (TX.any p) . toTextList |
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.
any (== True)
is or
src/Yi/Rope.hs
Outdated
go x = case viewl x of | ||
EmptyL -> True | ||
Chunk _ t :< ts -> TX.all p t && go ts | ||
all p = Prelude.all (==True) . fmap (TX.all p) . toTextList |
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.
all (== True)
is and
I think that's about everything. I removed the folding patch, because folding over small tress takes longer, and most users will probably be using small text files anyway. There should be an order of magnitude improvement in |
I've tried to run the benchmarks on my machine.
|
|
The speedup for |
I'm guessing that it has to do with creating the rope at the end (which results in calls to I'm not sure what caused the slowdown in I'm hoping I didn't make any mistakes. In the short term, there's a noticeable reduction in lag for the rasa text editor (which is what made me realize this in the first place). In the long run, it should allow us to use lines more liberally in Yi, since running lines on the full buffer isn't an expensive operation anymore (sans wide text). |
Could you extract the |
Thanks for putting time into this! I'm also looking into ways to cache some of the information we use In particular it would be useful to either index into specific lines in constant time or to be able to determine the number of characters within a given range/within a given row. I'm considering caching this on a per buffer level in Rasa. Since we recently limited the text-interface to range operations it should be plausible to keep an updated cache mapping line-number to line-length. That's besides this issue though; just figured I'd keep you informed. |
This has bitrotten a bit, please update. |
Rebased. |
The basic idea is:
ns == countNl x == lineIndex (measure ch)
andn - ns == lineIndex (measure f) - p - 1
Before:
After: