From 4172fd0463486af40ad545c239f2f8a37a8f4332 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Thu, 6 Jan 2022 23:22:10 +0100 Subject: [PATCH] Slightly more efficiently pre-allocate bitsets --- 2021/src/common.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2021/src/common.rs b/2021/src/common.rs index 162f2c1..123b7c3 100644 --- a/2021/src/common.rs +++ b/2021/src/common.rs @@ -113,7 +113,7 @@ impl BitSet { } pub fn with_capacity(capacity: usize) -> Self { - let buffer = Vec::with_capacity(capacity / 32); + let buffer = vec![0; capacity / 32]; Self { buffer } }