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

Re: Performance numbers on "if [" vs. "[" alone vs. "if [[" vs. "[[" alone



PS. To show how futile using [[ instead of if [[ might be, I have an
optimization that I once did:

https://github.com/psprint/zsh-navigation-tools/commit/4a064efb04a3903ceb227df24f5ef2bb3533781e

It gave 60 ms, that gain was stable otherwise I wouldn't commit it
(zprof's results didn't seem to get disturbed randomly), however,
_nlist_expand_tabs was called as much as 30000 times.

Best regards,
Sebastian Gniazdowski


On 16 September 2016 at 12:18, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> I've replaced near all if [[ ]] calls with [[ ]] in
> zsh-syntax-highlighting's main-highlighter.zsh, and no performance was
> gained. So unless there's a tight loop, if [[ doesn't slow down when
> compared to [[ alone.
>
>
> BTW. Running attached parse.zsh on toparse.zsh with zsh-5.2 in shebang
> produces following difference in generated region_highlight, to
> /bin/zsh (OS X 5.0.8):
>
> 439c439
> < 3878 3885 fg=yellow
> ---
>> 3878 3885 fg=green
>
> The same difference for 5.1.1, 5.1. Zsh-5.0.8-dev-0 doesn't produce
> the difference, and 5.0.8-dev-1 produces it, so apparently that's
> where the difference starts appearing, compared to OS X 5.0.8
> /bin/zsh.
>
> Best regards,
> Sebastian Gniazdowski



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