From 6e5a737e7a07861e2e2bdc9d79d093a74cc862de Mon Sep 17 00:00:00 2001 From: konsti Date: Wed, 13 Mar 2024 23:48:24 +0100 Subject: [PATCH] Update pubgrub for faster range operations (#2421) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update pulls in https://github.com/pubgrub-rs/pubgrub/pull/177, optimizing common range operations in pubgrub. Please refer to this PR for a more extensive description and discussion of the changes. The changes optimize that last remaining pathological case, `bio_embeddings[all]` on python 3.12, which has to try 100k versions, from 12s to 3s in the cached case. It should also enable smarter prefetching in batches (https://github.com/astral-sh/uv/issues/170), even though a naive attempt didn't show better network usage. **before** 12s ![image](https://github.com/pubgrub-rs/pubgrub/assets/6826232/80ffdc49-1159-453d-a3ea-0dd431df6d3b) **after** 3s ![image](https://github.com/pubgrub-rs/pubgrub/assets/6826232/69508c29-73ab-4593-a588-d8c722242513) ``` $ taskset -c 0 hyperfine --warmup 1 "../uv/target/profiling/main-uv pip compile ../uv/scripts/requirements/bio_embeddings.in" "../uv/target/profiling/branch-uv pip compile ../uv/scripts/requirements/bio_embeddings.in" Benchmark 1: ../uv/target/profiling/main-uv pip compile ../uv/scripts/requirements/bio_embeddings.in Time (mean ± σ): 12.321 s ± 0.064 s [User: 12.014 s, System: 0.300 s] Range (min … max): 12.224 s … 12.406 s 10 runs Benchmark 2: ../uv/target/profiling/branch-uv pip compile ../uv/scripts/requirements/bio_embeddings.in Time (mean ± σ): 3.109 s ± 0.004 s [User: 2.782 s, System: 0.321 s] Range (min … max): 3.103 s … 3.116 s 10 runs Summary ../uv/target/profiling/branch-uv pip compile ../uv/scripts/requirements/bio_embeddings.in ran 3.96 ± 0.02 times faster than ../uv/target/profiling/main-uv pip compile ../uv/scripts/requirements/bio_embeddings.in ``` It also adds `bio_embeddings[all]` as a requirements test case. --- Cargo.lock | 2 +- Cargo.toml | 2 +- scripts/requirements/bio_embeddings.in | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 scripts/requirements/bio_embeddings.in diff --git a/Cargo.lock b/Cargo.lock index 6b43b9ccf..c452aa0af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2564,7 +2564,7 @@ dependencies = [ [[package]] name = "pubgrub" version = "0.2.1" -source = "git+https://github.com/zanieb/pubgrub?rev=b5ead05c954b81690aec40255a1c36ec248e90af#b5ead05c954b81690aec40255a1c36ec248e90af" +source = "git+https://github.com/astral-sh/pubgrub?rev=addbaf184891d66a2dfd93d241a66d13bfe5de86#addbaf184891d66a2dfd93d241a66d13bfe5de86" dependencies = [ "indexmap 2.2.5", "log", diff --git a/Cargo.toml b/Cargo.toml index 0ad9b27fd..a7dbcbf85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ owo-colors = { version = "4.0.0" } pathdiff = { version = "0.2.1" } petgraph = { version = "0.6.4" } platform-info = { version = "2.0.2" } -pubgrub = { git = "https://github.com/zanieb/pubgrub", rev = "b5ead05c954b81690aec40255a1c36ec248e90af" } +pubgrub = { git = "https://github.com/astral-sh/pubgrub", rev = "addbaf184891d66a2dfd93d241a66d13bfe5de86" } pyo3 = { version = "0.20.3" } pyo3-log = { version = "0.9.0" } pyproject-toml = { version = "0.10.0" } diff --git a/scripts/requirements/bio_embeddings.in b/scripts/requirements/bio_embeddings.in new file mode 100644 index 000000000..5716ee72c --- /dev/null +++ b/scripts/requirements/bio_embeddings.in @@ -0,0 +1,2 @@ +# Run on python 3.12 for a pathological test case +bio_embeddings[all]