Skip to content

chore: fix 30% startup time hit from userpassword #12769

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

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

ammario
Copy link
Member

@ammario ammario commented Mar 27, 2024

pbkdf2 is too expensive to run in init, so this change makes it load
lazily. I introduced a lazy package that I hope to use more in my
GODEBUG=inittrace=1 adventure.

Benchmark results:

$ hyperfine "coder --help" "coder-new --help"
Benchmark 1: coder --help
  Time (mean ± σ):      82.1 ms ±   3.8 ms    [User: 93.3 ms, System: 30.4 ms]
  Range (min … max):    72.2 ms …  90.7 ms    35 runs
 
Benchmark 2: coder-new --help
  Time (mean ± σ):      52.0 ms ±   4.3 ms    [User: 62.4 ms, System: 30.8 ms]
  Range (min … max):    41.9 ms …  62.2 ms    52 runs
 
Summary
  coder-new --help ran
    1.58 ± 0.15 times faster than coder --help

pbkdf2 is too expensive to run in init, so this change makes it load
lazily. I introduced a lazy package that I hope to use more in my
`GODEBUG=inittrace=1` adventure.
Copy link
Member Author

ammario commented Mar 27, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ammario and the rest of your teammates on Graphite Graphite

@ammario ammario requested a review from kylecarbs March 27, 2024 01:25
@ammario ammario marked this pull request as ready for review March 27, 2024 01:25
@ammario ammario changed the title chore: fix 30ms startup time hit from userpassword chore: fix 30% startup time hit from userpassword Mar 27, 2024
Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@ammario ammario merged commit 0d9010e into main Mar 27, 2024
30 checks passed
@ammario ammario deleted the lazy-password branch March 27, 2024 01:47
Copy link
Member Author

ammario commented Mar 27, 2024

Merge activity

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants