djui/alias-tips

Performance Hit on Oh My Zsh

aksh1618 opened this issue · 2 comments

I love Alias tips, but it causes my startup time to take a severe hit, as shown by zprof:

~> zprof
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)    1         242.86   242.86   43.35%    242.86   242.86   43.35%  _alias_tips__preexec

Is there any way to fix/optimize this? I am using oh-my-zsh.

djui commented

I think the performance problems stem from the Python code that is being run; I believe the actual Zsh code is quite minimal and fast. It also depends linearly on the amount aliases and functions one has, but the Python runtime start up should be the dominant factor.
If we would port the code from Python to Go/Rust/C we could ship OS dependant binaries and get a better startup latency.

yld commented

You may look at https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/alias-finder witch is about 10 times faster (written in pure ZSH).