3 ms·
Why does the STL use such a poor implementation? It says it's performance is due to chasing pointers and allocating/freeing each node individually. Are stl impl
by unclad5968 2y ago
Why does the STL use such a poor implementation? It says it's performance is due to chasing pointers and allocating/freeing each node individually. Are stl implemented not able to change the details due to backwards compatibility?
- variadix 2y agoThe use of chaining and the requirement of pointer stability are written into the standard. Changing the implementation to do something else would require changing the standard, which would change the API contract, which would break existing code.
- cozzyd 2y agoYeah but they could add a better one with a different name (std::dict?)
- beached_whale 2y agoI think Boost::unordered_map is a drop in replacement, but I think it is the breaking of existing code part. Not that they couldn't pop that behind an ABI flag.