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
builtin time does not measure command substitutions #9100
Labels
Milestone
Comments
and finally: $ time echo -n (sleep 1)
________________________________________________________
Executed in 66.00 micros fish external
usr time 37.00 micros 37.00 micros 0.00 micros
sys time 32.00 micros 32.00 micros 0.00 micros |
Obviously, the command substitution is expanded before the timer starts, but that just can't be how we let it work. |
And the workaround: ~/f/fish-shell $ time begin; test "$root/$relfile" = (pwd -P)/$relfile; end
________________________________________________________
Executed in 311.00 micros fish external
usr time 65.00 micros 65.00 micros 0.00 micros
sys time 139.00 micros 139.00 micros 0.00 micros
~/f/fish-shell $ time begin; test "$root/$relfile" -ef ./$relfile; end
________________________________________________________
Executed in 40.00 micros fish external
usr time 13.00 micros 13.00 micros 0.00 micros
sys time 30.00 micros 30.00 micros 0.00 micros |
I imagine the most accurate option would be timing |
faho
changed the title
builtin time does not agree with CMD_DURATION for commands with substitutions
builtin time does not measure command substitutions
Jun 29, 2023
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to figure out why some benchmarking of a git.fish completion change I was considering, seemed not to be evidencing the same difference if I used
time
, versus if I ran it a bunch of times and compared withCMD_DURATION
.Specifically, the change was to the line
test "$root/$relfile" = (pwd -P)/$relfile;
:So it using
test … -ef …
here appears to be twice as fast.However, time reports:
The text was updated successfully, but these errors were encountered: