Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: One more heap optimization trick for zsh < 5.2



On 8 May 2016 at 18:35, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> If the size of $list is indeed the deciding factor here, I would
> suspect that you're now running into heap management during the
> pattern match against $~search_pattern, and there's really nothing
> at the level of shell coding that can change pattern match behavior.

I was testing the same input with 89k lines. The cause now
accidentally clarified. It's about zplugin's shadowing of autoload
function that does the neat trick that allows to copycat what autoload
does:

# declare -f n-list
n-list () {
    --zplg-reload-and-run
/Users/sgniazdowski/.zplugin/plugins/psprint---zsh-navigation-tools ''
n-list "$@"
}

https://github.com/psprint/zplugin/blob/28b615c6d728b22ec87a86026e7a463d731184ae/zplugin.zsh#L273-L287

First run is slow, second is normal and fast:

https://asciinema.org/a/99ercap3i6nri6ybiiayd0ejb

It's hard to describe what *reload-and-run does but you are the author
of this neat trick so I can skip this. How do you think what can be
happening inside Zsh?

Best regards,
Sebastian Gniazdowski



Messages sorted by: Reverse Date, Date, Thread, Author