indexmap icon indicating copy to clipboard operation
indexmap copied to clipboard

DOC: Comparison with HashMap

Open bluss opened this issue 8 years ago • 5 comments

See the list here: https://github.com/rust-lang/rust/issues/45273#issuecomment-336626535

bluss avatar Oct 14 '17 10:10 bluss

Also comparison here https://github.com/rust-lang/rust/pull/45282

Perf assessment: nothing too surprising. Ordermap holds up in the sense of having a usable performance but not the best for this use case.

perf comparison. With regular hashmap first, with ordermap second.

  • cpu-clock http://perf.rust-lang.org/compare.html?start=af7de7b6774b061b7809ce9aa6db31ea29df33c8&end=43308d48de7bbeb014fcd9f4caa1e82e56e394c2&stat=cpu-clock
  • wall time http://perf.rust-lang.org/compare.html?start=af7de7b6774b061b7809ce9aa6db31ea29df33c8&end=43308d48de7bbeb014fcd9f4caa1e82e56e394c2&stat=wall-time
  • instructions http://perf.rust-lang.org/compare.html?start=af7de7b6774b061b7809ce9aa6db31ea29df33c8&end=43308d48de7bbeb014fcd9f4caa1e82e56e394c2&stat=instructions%3Au
  • cycles http://perf.rust-lang.org/compare.html?start=af7de7b6774b061b7809ce9aa6db31ea29df33c8&end=43308d48de7bbeb014fcd9f4caa1e82e56e394c2&stat=cycles%3Au

bluss avatar Oct 18 '17 21:10 bluss

rustc now uses hashbrown right? It's also been a long time. It might be interesting to try this again?

nico-abram avatar Aug 30 '19 03:08 nico-abram

Well, it's certain that indexmap doesn't compete with hashbrown for performance in general. There are some special cases where indexmap might be faster, like for example iteration.

bluss avatar Oct 18 '19 19:10 bluss

@bluss & @cuviper How feasible (if at all) do you think it is to make IndexMap wrap hashbrown rather than implement its own hash table from scratch? hashbrown has its "raw" API, which is intended exactly for when you need to have relatively low-level control over the hash table, and might make things easier?

I ask specifically because I've been seeing some pretty sad resizing behavior, which I've since built a fix for, but the way indexmap is currently organized, it seems very difficult to swap out its map implementation in the way I had hoped.

jonhoo avatar Jun 30 '20 01:06 jonhoo

@jonhoo very feasible 🙂 #131

cuviper avatar Jun 30 '20 01:06 cuviper