Migrate resolver proof-of-concept to PubGrub (#97)

## Summary

This PR enables the proof-of-concept resolver to backtrack by way of
using the `pubgrub-rs` crate.

Rather than using PubGrub as a _framework_ (implementing the
`DependencyProvider` trait, letting PubGrub call us), I've instead
copied over PubGrub's primary solver hook (which is only ~100 lines or
so) and modified it for our purposes (e.g., made it async).

There's a lot to improve here, but it's a start that will let us
understand PubGrub's appropriateness for this problem space. A few
observations:

- In simple cases, the resolver is slower than our current (naive)
resolver. I think it's just that the pipelining isn't as efficient as in
the naive case, where we can just stream package and version fetches
concurrently without any bottlenecks.
- A lot of the code here relates to bridging PubGrub with our own
abstractions -- so we need a `PubGrubPackage`, a `PubGrubVersion`, etc.
This commit is contained in:
Charlie Marsh 2023-10-15 22:05:44 -04:00 committed by GitHub
parent a8d020f53c
commit 471a1d657d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 12301 additions and 257 deletions

View file

@ -16,12 +16,12 @@ TARGET=${1}
# Resolution with a cold cache.
###
hyperfine --runs 20 --warmup 3 --prepare "rm -f /tmp/requirements.txt" \
"./target/release/puffin-cli compile ${TARGET} --no-cache > /tmp/requirements.txt" \
"pip-compile ${TARGET} --rebuild --pip-args '--no-cache-dir' -o /tmp/requirements.txt"
"./target/release/puffin --no-cache compile ${TARGET} > /tmp/requirements.txt" \
"./target/release/main --no-cache compile ${TARGET} > /tmp/requirements.txt"
###
# Resolution with a warm cache.
###
hyperfine --runs 20 --warmup 3 --prepare "rm -f /tmp/requirements.txt" \
"./target/release/puffin-cli compile ${TARGET} > /tmp/requirements.txt" \
"pip-compile ${TARGET} -o /tmp/requirements.txt"
"./target/release/puffin compile ${TARGET} > /tmp/requirements.txt" \
"./target/release/main compile ${TARGET} > /tmp/requirements.txt"