alphapapa / magit-todos

Show source files' TODOs (and FIXMEs, etc) in Magit status buffer
GNU General Public License v3.0
741 stars 48 forks source link

Avoid loading Org on init #120

Closed meedstrom closed 2 years ago

meedstrom commented 3 years ago

I don't know if you consider this relevant or if I should make an issue with Doom Emacs instead. Perhaps our use-package declarations should defer magit-todos until first time they call up a magit buffer anyway.

But if it's possible within this codebase to not load Org immediately, maybe it's a good feature? Takes work off the shoulders of Doom and other community configs.

alphapapa commented 3 years ago

Maybe. Lots of things in Emacs use Org, and loading it once means not having to call require every time we format an Org item . But if it's causing a problem (and I don't know if it is--no one's mentioned it until now), that call could be moved into the appropriate function.

meedstrom commented 2 years ago

Few people may bring up the issue here because they don't know it's magit-todos, like how I at first had difficulty figuring out why Emacs starts slow in the first place, and it took some time to figure out that something is loading Org, and then some time to figure out whodunit.

Anyway, does require take much compute cycles? The docstring gives me the impression that if the package is already loaded, it's nearly a no-op -- it just checks for a match in the list features, something like (member 'org features), but it's a C function so probably even faster.

alphapapa commented 2 years ago

So you mean that magit-todos's loading Org was causing your Emacs startup time to be too long? How much of a difference was it making?

meedstrom commented 2 years ago

With Org: 1.8s by stopwatch (Doom dashboard reports 1.5s, emacs-init-time reports 1.3s)

Without Org: 1.2s by stopwatch (Doom dashboard reports 0.9s, emacs-init-time reports 0.75s)

I guess it doesn't fit all definitions of "slow", but it's noticeable to me. Sorry, I can't offer advice on whether or not you should move the require invocation, other than to say I'd move it if it was my package (and I'm assuming there isn't a meaningful runtime performance hit). Guess it's up to your tastes. You can close the issue.

jsigman commented 2 years ago

Second that the requirement to load org early is stopping me from using this (otherwise) excellent package. The reason why has to do with the emacs-jupyter package, not startup time

alphapapa commented 2 years ago

Ok, if it's presenting a problem, I don't mind making that change. Most cases won't involve an Org file anyway, and in the few that do, the change shouldn't be a performance problem, I think.

alphapapa commented 2 years ago

That should do it. Please let me know if the problem is solved for you.