From e1e9b0447c0e0e4ae285e02659e950fcbf322d4a Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 14 Jan 2025 11:53:46 -0500 Subject: [PATCH] Reduce distribution size to 200 bytes (#10601) ## Summary The last of these optimizations. The limit is now `RegistryBuiltDist` which includes `sdist: Option`. --- crates/uv-distribution-types/src/lib.rs | 10 +++++----- crates/uv-resolver/src/lock/mod.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/uv-distribution-types/src/lib.rs b/crates/uv-distribution-types/src/lib.rs index c7c6d1f29..2d9708fac 100644 --- a/crates/uv-distribution-types/src/lib.rs +++ b/crates/uv-distribution-types/src/lib.rs @@ -291,7 +291,7 @@ pub struct DirectUrlSourceDist { /// like using e.g. `foo @ https://github.com/org/repo/archive/master.zip` pub name: PackageName, /// The URL without the subdirectory fragment. - pub location: Url, + pub location: Box, /// The subdirectory within the archive in which the source distribution is located. pub subdirectory: Option, /// The file extension, e.g. `tar.gz`, `zip`, etc. @@ -370,7 +370,7 @@ impl Dist { DistExtension::Source(ext) => { Ok(Self::Source(SourceDist::DirectUrl(DirectUrlSourceDist { name, - location, + location: Box::new(location), subdirectory, ext, url, @@ -1343,10 +1343,10 @@ mod test { /// Ensure that we don't accidentally grow the `Dist` sizes. #[test] fn dist_size() { - assert!(size_of::() <= 232, "{}", size_of::()); - assert!(size_of::() <= 216, "{}", size_of::()); + assert!(size_of::() <= 200, "{}", size_of::()); + assert!(size_of::() <= 200, "{}", size_of::()); assert!( - size_of::() <= 232, + size_of::() <= 176, "{}", size_of::() ); diff --git a/crates/uv-resolver/src/lock/mod.rs b/crates/uv-resolver/src/lock/mod.rs index d0ef155cd..d427aa74f 100644 --- a/crates/uv-resolver/src/lock/mod.rs +++ b/crates/uv-resolver/src/lock/mod.rs @@ -2035,7 +2035,7 @@ impl Package { }); let direct_dist = DirectUrlSourceDist { name: self.id.name.clone(), - location, + location: Box::new(location), subdirectory: subdirectory.clone(), ext, url: VerbatimUrl::from_url(url),