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)
commit5f83bb4044f32b60d06717c609610f67411fc671
treeaa160afe3efb74c0b642d3d5a0d1b070e55955ca
parent3f7a42663fadf6f654677b702233cdf67f88361b
parent1fd3496a7c046da83aadd434e9c0fe1207cee6b5
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