Artawower / blamer.el

A git blame plugin for emacs inspired by VS Code's GitLens plugin
GNU General Public License v3.0
431 stars 15 forks source link

Potential optimization? #50

Closed Shooooooooo closed 9 months ago

Shooooooooo commented 1 year ago

The repository I am working on daily basis has many commits. The git blame operation itself takes several seconds. It is making operation in Emacs very slow once I enable Blamer. Do you think there is an opportunity for optimization by caching the git blame result? Thanks!

Artawower commented 1 year ago

Hi! I don't think caching would be a good idea in this case, it's not easy to sync the cache, plus when working with editable text the cache will have to be cleared after each change.

I've described one optimization option that won't block emacs https://www.reddit.com/r/emacs/comments/11gczbj/comment/jaxdrcl/?utm_source=share&utm_medium=web2x&context=3.

I will try to revise this implementation as soon as I have some more free time. It won't speed up blamer itself, but it will eliminate the emacs slowdown.

Artawower commented 1 year ago

Could you try this branch? enhancement/async-cmd Is it still as slow or has something changed?

Shooooooooo commented 1 year ago

Sorry for the slow reply. It may be a bit faster compared to master branch but still slow. If the intention is to make the git operation async, my control still freezes when it's loading the blame info.

Shooooooooo commented 1 year ago

Actually, I was wrong. Now that I’ve cleaned up my straight area and rebuild blamer.el. My control no longer freezes when loading commit info! Yay! Now I am finally able to enable blamer.el by default. Thank you so much! P.S. with this change, it also make sense to make blamer-idle-time to 0.

Artawower commented 9 months ago

This feature has recently been merged 🫡. If you have any questions about it, please create a new issue