Stepan Koltsov

Results 251 comments of Stepan Koltsov

Hashbrown PR: https://github.com/rust-lang/hashbrown/pull/293

Updated the PR with `insert_unique_unchecked` name to match new hashbrown API. However, unlike hashbrown, I opted not to return `(&K, &mut V)` from `insert_unique_unchecked` because returning these values caused significant...

Updated docs. There's a `IndexSet::insert_unique_unchecked` operation in the latest version of the PR.

@cuviper looks bad. Let me check again.

On my laptop, MacBook Pro, Intel Core i9, rustc 1.57.0-nightly (8c2b6ea37 2021-09-11) the numbers I gave are correct.

For 10k items: ``` test insert ... bench: 137,650 ns/iter (+/- 13,904) test insert_unique_unchecked ... bench: 116,824 ns/iter (+/- 25,202) ``` For 100: ``` test insert ... bench: 1,530 ns/iter...

> I don't see why you would change push though -- e.g. VacantEntry::insert just calls push and then does the indexing itself. And if I do that, there's no regression...

OK, proper (more or less) benchmark for 1000 inserts. 100 runs. Raw data: https://gist.github.com/stepancheg/b234abc8da06de88acc18c3a1c7adfe3 Averages of 100 run averages: insert: 15.632 insert_unique_unchecked: 13.105 Yes, I gave a too high number...

I'll post an update after another benchmark finishes.

OK, more benchmarks. Returning references from `insert_unique_unchecked` as implemented in current version of PR (https://github.com/bluss/indexmap/commit/969115bc29cb7c5e3caa4a05fa9bd92716cc3fcd) actually causes small regression for `insert_unique_unchecked` operation compared to returning nothing, but regression is even...