djui / alias-tips

An oh-my-zsh plugin to help remembering those aliases you defined once
786 stars 50 forks source link

Performance Hit on Oh My Zsh #49

Open aksh1618 opened 5 years ago

aksh1618 commented 5 years ago

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 5 years ago

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 4 years ago

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