Skip to content

Commit 0769b22

Browse files
committed
Worlds smallest optimization
Preallocate for 8 items in the vec. I chose this value for 1. features 2. description 3. payment hash 4. expire time 5. min_final_cltv 6. payment secret 7. route hint 8. for the memes
1 parent c93b59e commit 0769b22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning-invoice/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ impl InvoiceBuilder<tb::False, tb::False, tb::False, tb::False, tb::False, tb::F
550550
amount: None,
551551
si_prefix: None,
552552
timestamp: None,
553-
tagged_fields: Vec::new(),
553+
tagged_fields: Vec::with_capacity(8),
554554
error: None,
555555

556556
phantom_d: core::marker::PhantomData,

0 commit comments

Comments
 (0)