mattmc3 / antidote

https://getantidote.github.io - the cure to slow zsh plugin management
MIT License
855 stars 21 forks source link

Add a way to benchmark the loading time of installed plugins #183

Closed devnoname120 closed 3 months ago

devnoname120 commented 3 months ago

It would be tremendously useful if antidote had a mode or an option for measuring how much time each plugin takes to load in order to help troubleshoot/optimize one's list of plugins.

Something basic (e.g. single run) would already go a long way!

mattmc3 commented 3 months ago

Are you familiar with zprof? You can simply temporarily add zmodload zsh/zprof to the top of your .zshrc and zprof at the end to get profiling information. For more advanced profiling, you can also use XTRACE.

While it's not the most user-friendly output, it's pretty good for this purpose and well known, and there's lots of examples on the web of this kind of tuning:

When viewing the output, you'll want to remember that parts of your config that source other parts are aggregated, which means that times may appear to be double counted. For example, if you use antidote load, its time is the sum of all the time your plugins take, not simply the actual time antidote load itself takes.

As far as adding a feature to antidote, I don't think it adds much to re-implement features that already exist, even if there's a more streamlined way to show that data.