3 ms·
If you are naive about data access, like in this case of inserting into an array without preallocation, C++ STL collections are pretty slow. I once wrote an alg
by lukaslalinsky 10y ago
If you are naive about data access, like in this case of inserting into an array without preallocation, C++ STL collections are pretty slow. I once wrote an algorithm that made heavy use of dictionaries in C++ and Python and the Python version was significantly faster. C++ just does not have fast general purpose collections in the standard library.