Skip to content

Avoid serializing if lockfile does not change - #4945

Merged
ibraheemdev merged 2 commits into
mainfrom
ibraheem/fast-lock
Jul 9, 2024
Merged

ibraheemdev merged 2 commits into
mainfrom
ibraheem/fast-lock

Conversation

@ibraheemdev

Copy link
Copy Markdown
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

Comment thread crates/uv/src/commands/project/lock.rs Outdated
@ibraheemdev
ibraheemdev force-pushed the ibraheem/fast-lock branch from 49f4bc8 to 8ce42a3 Compare July 9, 2024 20:58
@ibraheemdev
ibraheemdev merged commit 8c9bd70 into main Jul 9, 2024
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants