refactor(sdk): Remove one Vec allocation.

`LinkedChunk::push_items_back` expects an `IntoIter<Item = Event>`.
`EventLinkedChunk::push_live_events` has an `events` of kind `&[Event]`.
Using `events.iter().cloned()` instead of `events.to_vec()` not only
removes one `Vec` allocation, but it allows the compiler to apply more
optimisation.

Checking on godbolt.org, I see twice fewer LLVM IR lines, and 2.8x times
less ASM code.
This commit is contained in:
Ivan Enderlin
2026-02-09 17:43:03 +01:00
parent c1c48c2309
commit f0ee76c27f
@@ -297,7 +297,7 @@ impl EventLinkedChunk {
}
}
self.chunks.push_items_back(events.to_vec());
self.chunks.push_items_back(events.iter().cloned());
}
/// Finish a network back-pagination for this linked chunk by updating the