]> git.lizzy.rs Git - rust.git/commit
Avoid excessive reallocations during item-bodies checking
authorBjörn Steinbrink <bsteinbr@gmail.com>
Fri, 26 Feb 2016 23:53:33 +0000 (00:53 +0100)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Fri, 26 Feb 2016 23:59:43 +0000 (00:59 +0100)
commit31fef237b639fac3a1b719110fa0cfad3df44332
treef4ad64cba631febeb8b57c303fd0bafec953debd
parentf59fd4642534e80a61982ce3e10c147d97054212
Avoid excessive reallocations during item-bodies checking

When foldings Substs, we map over VecPerParamSpace instances using
EnumeratedItems which does not provide an accurate size_hint()
in its Iterator implementation. This leads to quite a large number or
reallocations. Providing a suitable size_hint() implementation reduces
the time spent in item-bodies checking quite a bit.

```
crate  | before | after | ~change
-------|-------------------------
core   |  7.28s | 5.44s |   -25%
std    |  2.07s | 1.88s |  -9.2%
syntax |  8.86s | 8.30s |  -6.3%
```
src/librustc/middle/subst.rs