]> git.lizzy.rs Git - rust.git/commit
Add a cheap mode for `compute_missing_ctors`.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 17 Oct 2018 22:11:11 +0000 (09:11 +1100)
committerNicholas Nethercote <nnethercote@mozilla.com>
Mon, 22 Oct 2018 21:20:52 +0000 (08:20 +1100)
commitb5336c0b9755f635db4eafba6254e192ee451e6a
tree3048b8d7f13a010afde7abe53be1328275b42954
parent8a7048b72b7e9499dfae3f946baa92fc9e62a6b8
Add a cheap mode for `compute_missing_ctors`.

`compute_missing_ctors` is called a lot. It produces a vector, which can
be reasonably large (e.g. 100+ elements), but the vector is almost
always only checked for emptiness.

This commit changes `compute_missing_ctors` so it can be called in a
cheap way that just indicates if the vector would be empty. If
necessary, the function can subsequently be called in an expensive way
to compute the full vector.

This change reduces instruction counts for several benchmarks up to 2%.
src/librustc_mir/hair/pattern/_match.rs