Hacker News new | ask | show | jobs
by jolmg 1700 days ago
Is the launching of processes on Windows so much slower than on Unix-type OSes that it would cause it to be "so slow" for that reason?

Maybe the reason is another? Personally, I once had Magit act real slow at times because git-annex had added some git hook for something that I didn't need. Just removing that hook improved performance massively. Perhaps something similar is happening.

Also, I'm not sure Emacs Lisp can interface directly with C libraries, so using libgit2 might not be an option.

3 comments

I'm pretty sure it's the main reason. Look how many times Magit shells out to git to render the status buffer, too many to count: https://github.com/magit/magit/issues/1327

In a perfect world, Emacs would link to libgit2 and Magit would be adapted and folded into the core distribution.

I just called the status buffer from magit on a repo. It was 23 calls to git, mostly for rev-parse. The status buffer appeared instantaneously on a decade-old laptop.

Whatever is causing the slowness you're seeing, I don't think it's just because of the number of calls. It's probably the slowness of one or two specific commands, perhaps due to repo size.

Try opening the status buffer on a project with 50+ submodules. On microsoft Windows. Prepare to wait over 1 minute.
or when you are in the middle of a very large merge.
Are you testing on Windows though? I am specifically talking about Windows being the (biggest) problem with this architecture. It is very expensive to create new processes on Windows versus Unix (threads are cheaper on Windows though).
Another commenter said that they also experienced slowdowns on macOS, so I thought the OS actually didn't matter much on this, but based on disgruntledphd2's comment, I guess it does.
Well, I definitely notice the difference between using magit on Windows vs magit in WSL (on the same box).

Seems like there's something going on in the windows world.

Unfortunately, it's pretty slow on macOS, as well. I love Magit, but there are times when I feel like it's hindering me more than helping due to the performance.
I use it on a low spec MacBook Air, and it works just fine for me... never noticed any kind of slowness.

I only work on Emacs in small projects though... so maybe that's why it's fast for me?!

Yes it will depend on repository size.
That, and I often have multiple projects open at once. There's a note in the Magit manual about this and how it affects performance, but unfortunately, the workaround means that buffers don't get refreshed and you might see stale information unless you perform a manual refresh.
I noticed better performance using native-comp in magit (and the rest of emacs for what it’s worth) on macOS. Might be worth a shot!
> Also, I'm not sure Emacs Lisp can interface directly with C libraries, so using libgit2 might not be an option.

I believe these days (i.e. since emacs 25) it can via dynamic modules. There are ffi libraries built on top of it.