3 ms·
>Do not implement your own fancy data structures: instead use the Standard Template Library. I use STL map, set, and vector all of the time and they remove the
by charleslmunger 2y ago
>Do not implement your own fancy data structures: instead use the Standard Template Library. I use STL map, set, and vector all of the time and they remove the need for most other data-structures.
Don't the STL tree and map data structures have notoriously poor performance?
- roeles 2y agoI don't think you can make general statements about STL. I have seen a Pi4 outperform a core i7 in very specific cases. That was really unexpected. In other cases I saw a lot of runtime spent on std::map. I think the best advice is: learn to use a profiler.
- tsegratis 2y agoFrom memory, std::map is comparatively slow because the spec requires pointers to indices to be stable. In practice it is slow; see khash and many others Personally i don't think this matters too much; you're using c/c++; you're already fast