|
|
|
|
|
by jstimpfle
1864 days ago
|
|
> It is also hard to beat the performance of the STL If you want to re-create the STL, maybe. But you can make custom data structures tailored to your task at hand instead. For example, instead of a std::map or std::unordered_map that allocates and initializes each node separately, you could preallocate some of them in a big chunk of memory, hand them out via a bump allocator scheme, and later free them all at once. Instead of a std::sort algorithm, you could use a bucket sort if it's possible in your situation, to improve your asymptotics from O(n log n) to O(n). Etc, etc. |
|