diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-05-20 19:54:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-20 19:54:44 +0200 |
| commit | ac634bc811715613b5b96e0579736ebdae11784c (patch) | |
| tree | 895ab47748b4f3e1955f496342faf43b55fe1fe3 /compiler/rustc_trait_selection/src/lib.rs | |
| parent | 2941434d1b20231a277cc69c84df3e09ad9a0401 (diff) | |
| parent | de97d7393fd20215cdc1a2cacfa84290df4ae460 (diff) | |
| download | rust-ac634bc811715613b5b96e0579736ebdae11784c.tar.gz rust-ac634bc811715613b5b96e0579736ebdae11784c.zip | |
Rollup merge of #97215 - AngelicosPhosphoros:add_hashtable_iteration_complexity_note, r=thomcc
Add complexity estimation of iterating over HashSet and HashMap It is not obvious (at least for me) that complexity of iteration over hash tables depends on capacity and not length. Especially comparing with other containers like Vec or String. I think, this behaviour is worth mentioning. I run benchmark which tests iteration time for maps with length 50 and different capacities and get this results: ``` capacity - time 64 - 203.87 ns 256 - 351.78 ns 1024 - 607.87 ns 4096 - 965.82 ns 16384 - 3.1188 us ``` If you want to dig why it behaves such way, you can look current implementation in [hashbrown code](https://github.com/rust-lang/hashbrown/blob/f3a9f211d06f78c5beb81ac22ea08fdc269e068f/src/raw/mod.rs#L1933). Benchmarks code would be presented in PR related to this commit.
Diffstat (limited to 'compiler/rustc_trait_selection/src/lib.rs')
0 files changed, 0 insertions, 0 deletions
