Skip to content

Optimize diff-hl--update#283

Open
jamescherti wants to merge 1 commit into
dgutov:masterfrom
jamescherti:optimize-indirect-buffers
Open

Optimize diff-hl--update#283
jamescherti wants to merge 1 commit into
dgutov:masterfrom
jamescherti:optimize-indirect-buffers

Conversation

@jamescherti
Copy link
Copy Markdown
Contributor

@jamescherti jamescherti commented Jun 5, 2026

This pull request optimizes diff-hl--update.

@jamescherti jamescherti force-pushed the optimize-indirect-buffers branch 2 times, most recently from 92b5fa0 to f95dbef Compare June 5, 2026 15:27
@jamescherti
Copy link
Copy Markdown
Contributor Author

jamescherti commented Jun 5, 2026

This adds two optimizations during the buffer traversal.

First, (eq buf base) is checked before calling (buffer-base-buffer buf). This short-circuits evaluation to bypass the buffer-base-buffer call overhead.

Second, the boolean state of (or changes ref-changes) outside the loop. This prevents the Lisp interpreter from recalculating the same static condition for all active buffers.

@jamescherti jamescherti force-pushed the optimize-indirect-buffers branch from f95dbef to 8e0ef6d Compare June 5, 2026 16:46
@jamescherti jamescherti changed the title Ensure diff-hl-mode is bound and optimize diff-hl--update Optimize diff-hl--update Jun 5, 2026
@jamescherti jamescherti marked this pull request as draft June 5, 2026 16:58
@jamescherti jamescherti force-pushed the optimize-indirect-buffers branch from 8e0ef6d to 67eecb0 Compare June 5, 2026 17:02
@jamescherti jamescherti marked this pull request as ready for review June 5, 2026 17:10
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.

1 participant