Skip to content

Commit fbcc724

Browse files
refactor(prefetch): optimize result storage with Vec::with_capacity
- Changed initialization of processed_results to use Vec::with_capacity for improved performance by preallocating memory based on the length of accessions.
1 parent 05c09a8 commit fbcc724

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/prefetch/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub async fn identify_urls(
246246
// `join_all` preserves task order, which matches the input `accessions`
247247
// order, so a JoinError can be attributed to its accession rather than
248248
// being silently dropped.
249-
let mut processed_results = Vec::new();
249+
let mut processed_results = Vec::with_capacity(accessions.len());
250250
for (accession, result) in accessions.iter().zip(results) {
251251
match result {
252252
Ok(res) => processed_results.push(res),

0 commit comments

Comments
 (0)