2 ms·
In such an environment my implementation achieves a runtime of around 5.8s while Python3 manages 5.2s. 41% of the runtime of my impl. is spent on resizing (19
by bool3max 3y ago
In such an environment my implementation achieves a runtime of around 5.8s while Python3 manages 5.2s.
41% of the runtime of my impl. is spent on resizing (19 times) + finally freeing (once) the hashtable.
It's interesting that in your testing unordered_map managed a faster runtime than Python. I've attributed my implementation's defeat to the fact that it uses separate chaining while CPython uses open addressing (+ a bunch of other clever optimizations...), but seeing as unordered_map also uses separate chaining (as mandated by the C++ standard, apparently) and it managed a win in your testing, I'm interested to see how they do things.