]> git.proxmox.com Git - cargo.git/commitdiff
Auto merge of #7326 - Eh2406:map_dependencies, r=ehuss
authorbors <bors@rust-lang.org>
Wed, 4 Sep 2019 16:55:52 +0000 (16:55 +0000)
committerbors <bors@rust-lang.org>
Wed, 4 Sep 2019 16:55:52 +0000 (16:55 +0000)
`map_dependencies` is doing a deep clone, so lets make it cheaper

This removes a `FeatureMap::clone` that I noticed when profiling no-op builds of cargo, benchmarks show a ~5% improvement. Looks like #6880 means that there is a ref to every `Summery` so the `Rc::make_mut` dose a deep clone.

src/cargo/core/summary.rs

index 7080d22745344d43811900583808a06b0409313d..d6732ec89976c6d4a1c472d89c9d18c78bce7207 100644 (file)
@@ -26,7 +26,7 @@ pub struct Summary {
 struct Inner {
     package_id: PackageId,
     dependencies: Vec<Dependency>,
-    features: FeatureMap,
+    features: Rc<FeatureMap>,
     checksum: Option<String>,
     links: Option<InternedString>,
     namespaced_features: bool,
@@ -64,7 +64,7 @@ impl Summary {
             inner: Rc::new(Inner {
                 package_id: pkg_id,
                 dependencies,
-                features: feature_map,
+                features: Rc::new(feature_map),
                 checksum: None,
                 links: links.map(|l| l.into()),
                 namespaced_features,