-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
Use text properties instead of overlays for ANSI coloring #1500
Conversation
Makes sense to me. Overlays are indeed very slow in large numbers. Do we have tests for this ansi coloring feature? |
Yeah, you should remove them. Overall - impressive work. I was amazed by your comprehensive analysis of the problem!
Pretty sure we don't. A few tests would be nice to have. |
Also, I forgot to mention, but the code is good to merge for me (though some tests would be nice). |
Yeah, it's good to merge for sure - I just want us to update the changelog accordingly as well. |
332a2e6
to
1e7a874
Compare
Sorry for the delay.
I've already noticed |
Use text properties instead of overlays for ANSI coloring
Great! Thanks a lot! :-) |
Thanks indeed! |
TL;DR
This PR improves the performance of REPL buffers by using text properties instead of overlays for ANSI coloring.
Also, this fixes #1452 while removing the hacky workaround introduced by #1455.
I recently sent some PRs related to overlays in the REPL buffer,
but I've finally realized we should avoid using overlays for ANSI coloring in the first place.
It's simply because overlays are pretty slow. I improved the performance a bit in #1488, but it's not radical.
So, in this PR, I remove all code related to overlays and use text properties instead.
I measured the performance by calling
cider-repl--emit-interactive-output
repeatedly.The complete benchmark code is here, and the version of my Emacs is
GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0, NS apple-appkit-1343.14)
.As this figure shows, the overlay version (current master) is getting slower and slower as the number of lines in the REPL buffer increases.
Total time the overlay version spent on inserting 1000 lines is about 5 seconds. As for the text property version, it's about 0.6 seconds.
If no window displays the REPL buffer, it is much faster in the both cases:
I keep my changes in #1488 as is because they are harmless, but I can remove them if it is necessary.
I also wonder whether I should remove my old changelog entries related to overlays.
Since this PR removes old PRs' changes, it looks a bit strange that these changelog entries appears in the same release.
P.S.
While I had not intended that, the PR #1455 seems to have improved the performance significantly ;)
(This is the worst case, that is, all outputs have a trailing overlay.)