summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2023-03-22 09:57:46 +0100
committerJustus Winter <justus@sequoia-pgp.org>2023-03-22 09:57:46 +0100
commit26c48c35737583f3751e44ef5eb86018f8efed83 (patch)
tree9e854bff33f94d66eb60500b3afa834c671e83b5
parent5202e7f23579861db7ecbf5970a8416b306d73b2 (diff)
openpgp: Pre-allocate backing for the subpacket cache.
-rw-r--r--openpgp/src/packet/signature/subpacket.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs
index f0f878ec..cfcf059d 100644
--- a/openpgp/src/packet/signature/subpacket.rs
+++ b/openpgp/src/packet/signature/subpacket.rs
@@ -687,7 +687,7 @@ impl SubpacketArea {
{
let cache = self.parsed.lock().unwrap();
if cache.borrow().is_none() {
- let mut hash = HashMap::new();
+ let mut hash = HashMap::with_capacity(self.packets.len());
for (i, sp) in self.packets.iter().enumerate() {
hash.insert(sp.tag(), i);
}