-
-
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
Fix performance in fringe overlay placement #1964
Merged
bbatsov
merged 1 commit into
clojure-emacs:master
from
phillord:fix/eval-on-region-performance
Apr 3, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
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 a bit confused about the purpose of this. How exactly does capturing this value help solve the problem?
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.
--make-fringe-overlays-for-region
was getting called multiple times; afaict, the first handler is when ever a value returns right? And this will happen multiple times, if there are multiple top-level forms in the region? Butbeg
andend
never change for the life time of the handler, so this makes no sense So, all I am doing here is making sure that fringe-overlays-for-region is only called once in the lifetime of the response handler.Maybe I am misunderstanding how the response-handler works. AFAICT, nothing with the fringe overlays checks whether the overlay is already there, which is causing the problem.
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 just not sure this is the right way to check if there are overlays there or not.
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'd expect functions that create overlays to be idempotent instead of relying on flags like
fringed
. That is, ifcider--make-fringe-overlays-for-region
is called a second time on the same region, it detects that the overlay already exists and does nothing.You can detect the existence of overlays with functions like
overlays-in
.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.
@xiongtx I think that is a good idea, and the other hunk of the commit tries to address this (belts and braces). But, even here there is a performance issue.
make-fringe-overlays
makes many overlays, not just one. So, at a minimum, you have to move through every top-level sexp and check for an overlay at each point.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.
Nothing from me. I'd simply prefer a solution that doesn't rely on a closure-captured variable as such code would be easier to comprehend.
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.
Well,
beg
andend
are also captured; I just copied what was already there. Regardless, are you happy to accept the PR now?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.
Yeah, I'll take it as is.
Just add a changelog entry about the bugfix.
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.
Ah, there's already one.
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.
Thanks!