Git Product home page Git Product logo

Comments (15)

jorgebucaran avatar jorgebucaran commented on August 26, 2024 3

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

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024 1

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:

hydro/conf.d/hydro.fish

Lines 101 to 105 in 0c7e1be

for color in hydro_color_{pwd,git,error,prompt,duration}
function $color --on-variable $color --inherit-variable color
set --query $color && set --global _$color (set_color $$color)
end && $color
end

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!

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024 1

I found it. The problem is here

_hydro_prompt && _hydro_pwd

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024

I installed Hyperfine, followed your instructions, and this is what I got:

Tide

~/tank/hydro main
❯ hyperfine fish -i -c "exit" --warmup=10
Benchmark #1: fish
  Time (mean ± σ):       5.7 ms ±   0.5 ms    [User: 3.8 ms, System: 1.4 ms]
  Range (min … max):     5.3 ms …   9.0 ms    303 runs

Hydro

~/t/hydro main ❱ hyperfine fish -i -c "exit" --warmup=10
Benchmark #1: fish
  Time (mean ± σ):       5.6 ms ±   0.5 ms    [User: 3.6 ms, System: 1.5 ms]
  Range (min … max):     5.1 ms …   9.2 ms    395 runs

Specs

macOS Big Sur
MacBook Pro (15-inch, 2019)
Intel UHD Graphics 630 1536 MB
32 GB 2400 MHz DDR4
2.4 GHz 8コアIntel Core i9

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024

I'm also running the latest Fish from HEAD (not 3.1.2).

from hydro.

Princesseuh avatar Princesseuh commented on August 26, 2024

Hmm, that's weird (computers yay). I'll try a few things

Okay, so turns out running without -i makes the benchmarks much more closer so maybe it's something in my config?

Tide

Benchmark #1: fish
  Time (mean ± σ):      11.5 ms ±   1.1 ms    [User: 9.4 ms, System: 2.3 ms]
  Range (min … max):     7.0 ms …  13.4 ms    179 runs

Hydro

Benchmark #1: fish
  Time (mean ± σ):      11.1 ms ±   1.0 ms    [User: 8.9 ms, System: 2.4 ms]
  Range (min … max):     6.9 ms …  13.5 ms    198 runs

This is with hyperfine fish -c "exit", adding a warmup doesn't change the results

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024

Try commenting out everything in your config.fish just to be sure?

from hydro.

Princesseuh avatar Princesseuh commented on August 26, 2024

EDIT: Oh wait I'm dumb, it doesn't mesure the rest of the command when I don't put the ' that's why the results are different LMAO, I shouldn't be commenting before drinking coffee. Nevermind this comment

Ah, I figured it out, it's not the -i, it depend on how I write the hyperfine command

Using hyperfine 'fish -i -c "exit"' (note the ' around the command):

Hydro

~ ❱ hyperfine 'fish -i -c "exit"'
Benchmark #1: fish -i -c "exit"
  Time (mean ± σ):      22.9 ms ±   1.4 ms    [User: 18.0 ms, System: 5.9 ms]
  Range (min … max):    19.4 ms …  26.9 ms    107 runs

Tide

❯ hyperfine 'fish -i -c "exit"'
Benchmark #1: fish -i -c "exit"
  Time (mean ± σ):      15.5 ms ±   1.3 ms    [User: 12.7 ms, System: 3.3 ms]
  Range (min … max):    10.7 ms …  18.4 ms    143 runs

Without the ' around the command:

Hydro

~ ❱ hyperfine fish -i -c "exit"
Benchmark #1: fish
  Time (mean ± σ):      10.9 ms ±   1.3 ms    [User: 8.6 ms, System: 2.5 ms]
  Range (min … max):     6.9 ms …  13.4 ms    201 runs

Tide

❯ hyperfine fish -i -c "exit"
Benchmark #1: fish
  Time (mean ± σ):      11.5 ms ±   1.2 ms    [User: 9.2 ms, System: 2.4 ms]
  Range (min … max):     7.3 ms …  14.6 ms    165 runs

Might just be computers being computers or a bug in Hyperfine? Though I fail to see why it would affect Hydro more than Tide

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024

スクリーンショット 2021-01-20 3 58 07

Can't reproduce the issue. I didn't even comment out my config.fish where I customize Hydro colors (which will trigger --on-variable handlers and do nothing in the case of Tide). I have absolutely nothing else in my config.fish.

from hydro.

Princesseuh avatar Princesseuh commented on August 26, 2024

It's effectively the -i flag that cause the 10ms difference in my case, removing my config (apart from the part where I load fisher plugins) doesn't change this, neither does removing any functions that run on fish_prompt event.

I'm gonna try on a completely empty config with all my plugins removed, sorry for the inconvenience 😅

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024

No problem. By the way, are you using a custom $fisher_path? You don't need to do this unless you have a custom $fisher_path, but I see no indication of that in your config.fish, hence the question.

from hydro.

Princesseuh avatar Princesseuh commented on August 26, 2024

Removed my entire Fish folder so all the screenshots are with the base config of Fish (I'm using fish, version 3.1.2 however, not HEAD), Fisher and the installed prompt in their base form (no customization on Tide)

Base prompt:

image

Hydro:

image

Tide:

image

Trying out with HEAD of Fish, I get the more or less the same results (albeit everything seems a bit faster, cool stuff), still an unusual spike with Hydro with -i. I'm not sure what more I can provide than that, sorry! Here's a few random infos if anything can tip you off maybe:

Config:
WM: Sway 1.5.1 (so Wayland)
Terminal: alacritty 0.6.0
CPU: i7-3930k
GPU: GTX 1080ti (using Nouveau)

No problem. By the way, are you using a custom $fisher_path? You don't need to do this unless you have a custom $fisher_path, but I see no indication of that in your config.fish, hence the question.

Yes, the variable is defined here. I was originally hoping to have all the fisher stuff outside of config.fish but it turns out I needed plugins to be loaded at the end of config.fish for a reason I don't remember

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024

Actually, just hyperfine "fish -i -c exit" is still correct (and easier to read). Did you comment out everything in your config.fish? It'd be nice if you could do that and try again.

from hydro.

Princesseuh avatar Princesseuh commented on August 26, 2024

Actually, just hyperfine "fish -i -c exit" is still correct (and easier to read)

True, I just mindlessly copy-pasted it (doesn't affect the results just in case you wonder)

Did you comment out everything in your config.fish? It'd be nice if you could do that and try again.

These screenshots are using a completely vanilla Fish config (removed the entire fish config folder), so there's nothing to comment.

Unless you mean on my normal configuration, in which case commenting everything did not change the results, neither did removing any functions that ran on prompt

from hydro.

jorgebucaran avatar jorgebucaran commented on August 26, 2024

That part appears to be a code relic from an earlier shape of this prompt, but we no longer need it. We were running it twice!

As for _hydro_pwd, we can delay it until the fish_prompt event handler fires. 💯

from hydro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.