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

Avoid serializing if lockfile does not change #4945

Merged
merged 2 commits into from
Jul 9, 2024
Merged

Conversation

ibraheemdev
Copy link
Member

Summary

Avoid serializing and writing the lockfile if a cheap comparison shows that the contents have not changed.

Test Plan

Shaves ~10ms off of #4860 for me.

➜  transformers hyperfine "../../uv/target/profiling/uv lock" "../../uv/target/profiling/baseline lock" --warmup 3
Benchmark 1: ../../uv/target/profiling/uv lock
  Time (mean ± σ):     130.5 ms ±   2.5 ms    [User: 130.3 ms, System: 85.0 ms]
  Range (min … max):   126.8 ms … 136.9 ms    23 runs
 
Benchmark 2: ../../uv/target/profiling/baseline lock
  Time (mean ± σ):     140.5 ms ±   5.0 ms    [User: 142.8 ms, System: 85.5 ms]
  Range (min … max):   133.2 ms … 153.3 ms    21 runs
 
Summary
  ../../uv/target/profiling/uv lock ran
    1.08 ± 0.04 times faster than ../../uv/target/profiling/baseline lock

@ibraheemdev ibraheemdev requested a review from konstin July 9, 2024 20:51
@ibraheemdev ibraheemdev added the performance Potential performance improvement label Jul 9, 2024
@ibraheemdev ibraheemdev merged commit 8c9bd70 into main Jul 9, 2024
49 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/fast-lock branch July 9, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Potential performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants