Slightly more efficient vec initialization (#120)

This will, at least on x86_64, compile down to simpler, shorter assembly that uses a zeroed allocation instead of a regular allocation, a memset and various `raw_vec` methods.
This commit is contained in:
Johan Milanov
2023-04-03 22:49:36 +02:00
committed by GitHub
parent 2bd03256b3
commit 9c6d6dc9aa

View File

@@ -18,8 +18,7 @@ pub fn calculate<'a, SuccFn: Fn(Block) -> &'a [Block]>(
let mut ret = vec![];
// State: visited-block map, and explicit DFS stack.
let mut visited = vec![];
visited.resize(num_blocks, false);
let mut visited = vec![false; num_blocks];
struct State<'a> {
block: Block,