hydro: Hydro slowdown Fish's launch

Even though Hydro is much faster than Tide at rendering the prompt, like advertised (measured using time fish_prompt)

Hydro:

Executed in  172,00 micros    fish           external
   usr time  159,00 micros  159,00 micros    0,00 micros
   sys time   15,00 micros   15,00 micros    0,00 micro

Tide:

Executed in    2,06 millis    fish           external
   usr time    2,04 millis    2,04 millis    0,00 micros
   sys time    0,01 millis    0,01 millis    0,00 micros

It comes with the downside that it slowdown the launch (or perhaps the shutdown?) of Fish by roughly 8-10ms (mesured using hyperfine with the command fish -i -c "exit") on my machine:

Hydro:

Benchmark #1: fish -i -c "exit"
  Time (mean ± σ):      24.7 ms ±   1.4 ms    [User: 20.1 ms, System: 6.0 ms]
  Range (min … max):    20.1 ms …  30.3 ms    102 runs

Tide:

Benchmark #1: fish -i -c "exit"
  Time (mean ± σ):      16.7 ms ±   1.1 ms    [User: 14.1 ms, System: 3.5 ms]
  Range (min … max):    11.8 ms …  18.6 ms    146 runs

This is with the default settings on Hydro and the Pure preset on Tide with few icons. I can reproduce those results by uninstalling / reinstalling both prompts. My config.fish file is available here if needed

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you, @Princesseuh! It’s looking a lot better now.

Need for speed ey? I can’t notice any difference using time fish -c exit between Hydro and function fish_prompt; echo; end. But I suppose Hyperfine can see things Fish’s time can’t.

I suspect the problem is here:

https://github.com/jorgebucaran/hydro/blob/0c7e1beb17c8e33ecfa647b347dff60666279a6a/conf.d/hydro.fish#L101-L105

I was actually planning to remove all that because it always takes me a while to remember what I am doing there. The goal was to cache the color codes, in the hope that would make fish_prompt faster.

Thanks for the detailed report!