Closed Pratyush closed 7 years ago
I pushed some updates:
from_iter
benchmark.#[inline]
attributes because they weren't giving any speed-ups on the benchmarks. Perhaps the compiler is smart enough to know when to inline function calls in our case.
Hi,
This is a PR for some perf improvements:
A new
FromIterator
impl that collects the iterator into aVec
, sorts it by the key, dedups by the key, and constructs a newFlatMap
from this. This is much faster for large inputs than inserting each pair one by one because the latter requires moving elements down the vector whenever an insertion occurs.I added
#[inline]
attributes to small functions.I also added some benchmarks comparing the map to BTreeMap from the stdlib, and added myself to the contributors list.