Auto merge of #5157 - Eh2406:more_interning, r=alexcrichton
authorbors <bors@rust-lang.org>
Fri, 9 Mar 2018 17:56:35 +0000 (17:56 +0000)
committerbors <bors@rust-lang.org>
Fri, 9 Mar 2018 17:56:35 +0000 (17:56 +0000)
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


Trivial merge