]> git.lizzy.rs Git - rust.git/commit
Avoid allocations in `has_any_child_of`.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 18 Jun 2018 04:52:59 +0000 (14:52 +1000)
committerNicholas Nethercote <nnethercote@mozilla.com>
Mon, 18 Jun 2018 23:37:26 +0000 (09:37 +1000)
commit8c7433a3ccf80b38270b3e29bf37fe58c1796d2a
tree84c390224cc1ecd27a24191e4f51162f9c6a8b4d
parent2b973e653257f965e33a61b58c0eb7e863aed6c8
Avoid allocations in `has_any_child_of`.

`has_any_child_of` is hot. It allocates a `Vec` that almost always
doesn't exceed a length of 1.

This patch peels off the first iteration of the loop, avoiding the need
for the `Vec` creation in ~99% of cases.
src/librustc_mir/dataflow/at_location.rs