- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.7k
Closed
Labels
A-cargo-apiArea: cargo-the-library API and internal code issuesArea: cargo-the-library API and internal code issues
Description
Cargo sometimes makes a lot of copies of data structures. For example the string "serde", was copied for the name of each dependency on that crate, as the name of each version of that package, and for each feature that enables that package. This got fixed by adding a InternedString data type that deduplicates the data and leaks it into a &'static reference. We have other data structures which use Arc/Rc to make cloning cheaper.
We should experiment with Interning them to see if it is a Speed or Memory or Ergonomic win.
Off the top of my head:
-  PackageIdis already usingArc, is copied and hashed and compared all over the place in hot code.
-  SourceIdis already usingArc, has a manual cache forcrates.ioand will probably be leaked anyway by cachingPackageId.
-  semver::Version/semver::VersionReqare used a lot, probably often with the same value, and are bigger structures then they seem.
Metadata
Metadata
Assignees
Labels
A-cargo-apiArea: cargo-the-library API and internal code issuesArea: cargo-the-library API and internal code issues