From: bors Date: Fri, 9 Mar 2018 17:56:35 +0000 (+0000) Subject: Auto merge of #5157 - Eh2406:more_interning, r=alexcrichton X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~53 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5f83bb4044f32b60d06717c609610f67411fc671;p=cargo.git Auto merge of #5157 - Eh2406:more_interning, r=alexcrichton More interning This is a forward approach to interning. Specifically `Dependency` and `PackageId` store their names as `InternedString`s and leave that value interned as long as possible. The alternative is to make a new `interned_name` function. The advantage of this approach is that a number of places in the code are doing `deb.name() == pid.name()` and are now using the fast pointer compare instead of the string compare, without the code needing to change. The disadvantage is that lots of places need to call `deref` with `&*` to convert to an `&str` and sum need to use `.to_inner()` to get a `&'static str`. In a test on https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286 Before we got to 10000000 ticks in ~48 sec After we got to 10000000 ticks in ~44 sec --- 5f83bb4044f32b60d06717c609610f67411fc671