uv
6de869cc - Speed up cache size command (#17015)

Commit
2 days ago
Speed up cache size command (#17015) ## Summary `uv cache size` can be quite slow. Here i use https://github.com/sharkdp/diskus to walk the cache directory with in multiple threads. Add cli option to set the number of threads and default to ` std::thread::available_parallelism()` or 1. ## Test Plan Added cli statement with info log test. I believe this is a fair test, where i set cache dir to a large directory. ```bash matthew@matthew-main ~/develop/personal/uv [14:17:50] [±cache-size-speed-up ✓▴] > $ uv cache size --preview-features cache-size -H --cache-dir ~/develop/ [±cache-size-speed-up ✓▴] 75.7GiB matthew@matthew-main ~/develop/personal/uv [14:18:24] > $ hyperfine 'uv cache size --preview-features cache-size -H --cache-dir ~/develop/' 'target/debug/uv cache size --preview-features cache-size -H --cache-dir ~/develop/' [±cache-size-speed-up ✓▴] Benchmark 1: uv cache size --preview-features cache-size -H --cache-dir ~/develop/ Time (mean ± σ): 1.059 s ± 0.014 s [User: 0.171 s, System: 0.884 s] Range (min … max): 1.048 s … 1.097 s 10 runs Benchmark 2: target/debug/uv cache size --preview-features cache-size -H --cache-dir ~/develop/ Time (mean ± σ): 413.8 ms ± 17.1 ms [User: 5789.2 ms, System: 1682.0 ms] Range (min … max): 386.3 ms … 441.6 ms 10 runs Summary target/debug/uv cache size --preview-features cache-size -H --cache-dir ~/develop/ ran 2.56 ± 0.11 times faster than uv cache size --preview-features cache-size -H --cache-dir ~/develop/ ```
Author
Parents
Loading