Reduce distribution size to 200 bytes (#10601)

## Summary

The last of these optimizations. The limit is now `RegistryBuiltDist`
which includes `sdist: Option<RegistrySourceDist>`.
This commit is contained in:
Charlie Marsh
2025-01-14 11:53:46 -05:00
committed by GitHub
parent 692171c718
commit e1e9b0447c
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -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<Url>,
/// The subdirectory within the archive in which the source distribution is located.
pub subdirectory: Option<PathBuf>,
/// 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::<Dist>() <= 232, "{}", size_of::<Dist>());
assert!(size_of::<BuiltDist>() <= 216, "{}", size_of::<BuiltDist>());
assert!(size_of::<Dist>() <= 200, "{}", size_of::<Dist>());
assert!(size_of::<BuiltDist>() <= 200, "{}", size_of::<BuiltDist>());
assert!(
size_of::<SourceDist>() <= 232,
size_of::<SourceDist>() <= 176,
"{}",
size_of::<SourceDist>()
);
+1 -1
View File
@@ -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),