about summary refs log tree commit diff
path: root/src/test/incremental/thinlto
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-05-02 10:28:37 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2018-05-03 22:14:35 +1000
commit7cf142f78b82b0b2ae08b52ccb6a6e15c0270c38 (patch)
tree8c2bde3dcd85a2b9bbb49d281966cb52c47cb5c6 /src/test/incremental/thinlto
parentf76f6fbdea497c3cb536e33387f405cc74b99b76 (diff)
downloadrust-7cf142f78b82b0b2ae08b52ccb6a6e15c0270c38.tar.gz
rust-7cf142f78b82b0b2ae08b52ccb6a6e15c0270c38.zip
Avoid many `cmt` allocations.
`cmt` is a ref-counted wrapper around `cmt_` The use of refcounting
keeps `cmt` handling simple, but a lot of `cmt` instances are very
short-lived, and heap-allocating the short-lived ones takes up time.

This patch changes things in the following ways.

- Most of the functions that produced `cmt` instances now produce `cmt_`
  instances. The `Rc::new` calls that occurred within those functions
  now occur at their call sites (but only when necessary, which isn't
  that often).

- Many of the functions that took `cmt` arguments now take `&cmt_`
  arguments. This includes all the methods in the `Delegate` trait.

As a result, the vast majority of the heap allocations are avoided. In
an extreme case, the number of calls to malloc in tuple-stress drops
from 9.9M to 7.9M, a drop of 20%. And the compile times for many runs of
coercions, deep-vector, and tuple-stress drop by 1--2%.
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions