From 28ebfe87bfb34f4efbd4a5f418128f4096dd1b2a Mon Sep 17 00:00:00 2001 From: Britt Cyr Date: Tue, 27 Aug 2024 07:53:20 -0400 Subject: [PATCH] remove todo for batch (#25) --- programs/manifest/src/program/processor/batch_update.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/programs/manifest/src/program/processor/batch_update.rs b/programs/manifest/src/program/processor/batch_update.rs index 2b6fa8a81..f6689d45d 100644 --- a/programs/manifest/src/program/processor/batch_update.rs +++ b/programs/manifest/src/program/processor/batch_update.rs @@ -205,8 +205,7 @@ pub(crate) fn process_batch_update( }; // Result is a vector of (order_sequence_number, data_index) - // TODO: Do not use a vector and just write as we go. - let mut result: Vec<(u64, DataIndex)> = Vec::new(); + let mut result: Vec<(u64, DataIndex)> = Vec::with_capacity(orders.len()); for place_order in orders { { let base_atoms: BaseAtoms = BaseAtoms::new(place_order.base_atoms()); @@ -253,8 +252,8 @@ pub(crate) fn process_batch_update( expand_market_if_needed(&payer, &market, &system_program)?; } + let mut buffer: Vec = Vec::with_capacity(result.len()); let return_data: BatchUpdateReturn = BatchUpdateReturn { orders: result }; - let mut buffer: Vec = Vec::new(); return_data.serialize(&mut buffer).unwrap(); set_return_data(&buffer[..]);