magit-todos icon indicating copy to clipboard operation
magit-todos copied to clipboard

Avoid loading Org on init

Open meedstrom opened this issue 2 years ago • 5 comments

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.

meedstrom avatar Aug 26 '21 09:08 meedstrom

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.

alphapapa avatar Aug 26 '21 16:08 alphapapa

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.

meedstrom avatar May 04 '22 16:05 meedstrom

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?

alphapapa avatar May 05 '22 13:05 alphapapa

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.

meedstrom avatar Jun 06 '22 21:06 meedstrom

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

jsigman avatar Aug 06 '22 12:08 jsigman

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 avatar Aug 15 '22 20:08 alphapapa

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

alphapapa avatar Aug 15 '22 20:08 alphapapa