Skip to content
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

Improve performance of delete-selection-pre-hook when no region is active #794

Merged
merged 1 commit into from
Oct 10, 2017

Conversation

rgemulla
Copy link
Contributor

@rgemulla rgemulla commented Oct 10, 2017

This is a small change to the delete-selection-pre-hook advice to avoid unnecessary computations.

I noticed sluggish responses when moving around some buffers; profiling revealed the advice to delete-selection-pre-hook to be the culprit. In particular, it repeatedly called sp-wrap--can-wrap-p, which ate a large fraction of CPU time. With this patch, sp-wrap--can-wrap-p is only called when there actually is an active region. The additional condition is directly taken from delete-selection-pre-hook; it is used there to decide whether to do something. With this small change, the problem of sluggish response times went away.

@Fuco1 Fuco1 merged commit 7719b00 into Fuco1:master Oct 10, 2017
@Fuco1
Copy link
Owner

Fuco1 commented Oct 10, 2017

Thanks, nice catch!

@rgemulla rgemulla deleted the fix-delete-selection-pre-hook branch October 10, 2017 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants