Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significantly slower to source paths to a different directory #92

Open
OJFord opened this issue Nov 3, 2020 · 4 comments
Open

Significantly slower to source paths to a different directory #92

OJFord opened this issue Nov 3, 2020 · 4 comments

Comments

@OJFord
Copy link

OJFord commented Nov 3, 2020

I'm hesitant to even open this, because I really don't understand what or how is happening, but it's really repeatable and badly affects my terminal start time:

With a time bass source .profile in my config.fish:

# [new terminal window]
________________________________________________________
Executed in    3.63 secs   fish           external
   usr time  280.52 millis  1361.00 micros  279.16 millis
   sys time  330.70 millis    0.00 micros  330.70 millis

~>time bass source .profile

________________________________________________________
Executed in  130.04 millis    fish           external
   usr time   98.23 millis    0.00 millis   98.23 millis
   sys time   14.84 millis    5.71 millis    9.14 millis

~>fish

________________________________________________________
Executed in    3.51 secs   fish           external
   usr time  226.67 millis    4.50 millis  222.18 millis
   sys time  310.05 millis    0.64 millis  309.42 millis

~>head -n1 .config/fish/config.fish
time bass source "$HOME/.profile"

Why is it so much slower when invoked from config.fish? Sure, there's other stuff in there, but it's only the bass source that I'm timing, as the combination of fish & head outputs show.

@OJFord
Copy link
Author

OJFord commented Nov 3, 2020

Oh, ah!

~>time bass source "$HOME/.profile"

________________________________________________________
Executed in    3.57 secs   fish           external
   usr time  268.13 millis    1.76 millis  266.38 millis
   sys time  291.01 millis    3.44 millis  287.57 millis

(Changed .profile to $HOME/.profile in order to exactly match config.fish!)

@OJFord OJFord changed the title Significantly slower during config.fish than in a running shell? Significantly slower to source a path with interpolated env var Nov 3, 2020
@OJFord
Copy link
Author

OJFord commented Nov 3, 2020

Which of course you'd think could only be a fish issue, but:

~>time echo "$HOME/.profile" >/dev/null

________________________________________________________
Executed in  122.00 micros    fish           external
   usr time  128.00 micros  128.00 micros    0.00 micros
   sys time   17.00 micros   17.00 micros    0.00 micros

I don't understand this..!

@OJFord
Copy link
Author

OJFord commented Nov 3, 2020

Ah, of course.. 🤦 - it's not that there's a variable interpolated, it's that it's an absolute path:

~>time bass source /home/ojf/.profile

________________________________________________________
Executed in    3.63 secs   fish           external
   usr time  309.51 millis    2.36 millis  307.15 millis
   sys time  332.80 millis    3.63 millis  329.16 millis
~>pwd
/home/ojf
~>time bass source .profile

________________________________________________________
Executed in  119.79 millis    fish           external
   usr time   94.47 millis    2.33 millis   92.14 millis
   sys time    9.40 millis    2.67 millis    6.73 millis

@OJFord OJFord changed the title Significantly slower to source a path with interpolated env var Significantly slower to source an absolute path vs. relative Nov 3, 2020
@OJFord
Copy link
Author

OJFord commented Nov 3, 2020

Wrong again..! It seems to be the presence of forward slashes, not necessarily that it's at the beginning (an absolute path).

@OJFord OJFord changed the title Significantly slower to source an absolute path vs. relative Significantly slower to source paths to a different directory Nov 3, 2020
OJFord added a commit to OJFord/dotfiles that referenced this issue Nov 3, 2020
OJFord added a commit to OJFord/dotfiles that referenced this issue Nov 13, 2020
OJFord added a commit to OJFord/dotfiles that referenced this issue Nov 14, 2020
OJFord added a commit to OJFord/dotfiles that referenced this issue Nov 14, 2020
OJFord added a commit to OJFord/dotfiles that referenced this issue Nov 17, 2020
OJFord added a commit to OJFord/dotfiles that referenced this issue Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant