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

perf(sh-activate): avoid a pyenv-version-name call #380

Merged
merged 1 commit into from
Nov 13, 2021
Merged

perf(sh-activate): avoid a pyenv-version-name call #380

merged 1 commit into from
Nov 13, 2021

Conversation

scop
Copy link
Contributor

@scop scop commented Mar 11, 2021

Before:

$ hyperfine -i "pyenv sh-activate --quiet"
Benchmark #1: pyenv sh-activate --quiet
  Time (mean ± σ):      49.1 ms ±   3.0 ms    [User: 40.7 ms, System: 10.7 ms]
  Range (min … max):    45.4 ms …  59.0 ms    53 runs

After:

$ hyperfine -i "pyenv sh-activate --quiet"
Benchmark #1: pyenv sh-activate --quiet
  Time (mean ± σ):      39.5 ms ±   1.4 ms    [User: 31.4 ms, System: 9.7 ms]
  Range (min … max):    36.4 ms …  44.8 ms    70 runs

Before:
$ hyperfine -i "pyenv sh-activate --quiet"
Benchmark #1: pyenv sh-activate --quiet
  Time (mean ± σ):      49.1 ms ±   3.0 ms    [User: 40.7 ms, System: 10.7 ms]
  Range (min … max):    45.4 ms …  59.0 ms    53 runs

After:
$ hyperfine -i "pyenv sh-activate --quiet"
Benchmark #1: pyenv sh-activate --quiet
  Time (mean ± σ):      39.5 ms ±   1.4 ms    [User: 31.4 ms, System: 9.7 ms]
  Range (min … max):    36.4 ms …  44.8 ms    70 runs
@teekennedy
Copy link

This is a highly welcome change from my perspective. pyenv sh-activate is ran before every command in an interactive shell, and it appears that runningpyenv-version-name is one of the more expensive calls in this script. Merging this should lead to a more responsive shell experience 👍

@native-api native-api merged commit 91609e2 into pyenv:master Nov 13, 2021
@scop scop deleted the perf-sh-activate branch November 14, 2021 08:57
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

Successfully merging this pull request may close these issues.

None yet

3 participants