prefix-dev / rip

Solve and install Python packages quickly with rip (pip in Rust)
https://prefix.dev
BSD 3-Clause "New" or "Revised" License
643 stars 21 forks source link

feat: use new asynchronous resolvo code #200

Closed tdejager closed 7 months ago

tdejager commented 7 months ago

get_dependencies and get_candidates now spawn tasks to process asynchronously.

aochagavia commented 7 months ago

Happy to see it worked out in the end!

tdejager commented 7 months ago

Quick benchmark:

There are two versions:

Both were compiled with --release and copied over. Don't know about the statistical interference, I had no discord or IDE running. Nonetheless, relative numbers stayed equal so don't think it matters much for comparison.

Benchmark 1 without a cache

Command: hyperfine "./rip quetz-server" "./rip-async quetz-server" --prepare "rm -rf /Users/tdejager/Library/Caches/rattler/"

Benchmark 1: ./rip quetz-server
  Time (mean ± σ):      2.952 s ±  0.129 s    [User: 0.578 s, System: 0.363 s]
  Range (min … max):    2.802 s …  3.129 s    10 runs

Benchmark 2: ./rip-async quetz-server
  Time (mean ± σ):      1.975 s ±  1.242 s    [User: 0.481 s, System: 0.395 s]
  Range (min … max):    1.343 s …  5.483 s    10 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Summary
  ./rip-async quetz-server ran
    1.49 ± 0.94 times faster than ./rip quetz-server

Benchmark 2 with a cache

Command: hyperfine "./rip quetz-server" "./rip-async quetz-server" -w 2

Benchmark 1: ./rip quetz-server
  Time (mean ± σ):      1.567 s ±  0.074 s    [User: 0.339 s, System: 0.457 s]
  Range (min … max):    1.469 s …  1.707 s    10 runs

Benchmark 2: ./rip-async quetz-server
  Time (mean ± σ):      1.094 s ±  0.428 s    [User: 0.371 s, System: 2.439 s]
  Range (min … max):    0.803 s …  2.021 s    10 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Summary
  ./rip-async quetz-server ran
    1.43 ± 0.56 times faster than ./rip quetz-server

Seems like a nice improvement!

tdejager commented 7 months ago

Before merge

baszalmstra commented 7 months ago

This is ready for a final review! @tdejager @nichmor @wolfv