Personal note: Following the C++ and Beyond seminar in October, I decided to replace the session “A Fresh Look at Containers and Iterators”. This is because the topic, albeit generous, has limited immediate applicability. Although the C++ community has considerable interest in packing iterators together in ranges and using range-oriented algorithms (per abstractions present in Boost and Adobe), mainstream use of STL remains through iterators. The new material concerns a much more immediate concern of C++ programmers.
STL’s performance has been satisfactory for a large range of applications. However, when using STL in large scale programs that have large tight performance programs, special care needs to be taken that doesn’t apply to smaller data sets. Amortized constant time is not terribly useful if multiplied by a constant that makes your application run forever. Doubling the size of a vector has unexpected effects. STL’s node allocation policy, while useful at small scale, may badly hurt performance. The allocator interface is unable to perform in-place reallocation. Even using realloc for moveable types is suboptimal. Finally, all stock allocators are very coy about releasing back memory to the operating system, which creates odd problems in long-running programs. This talk focuses on concrete tips for using STL (and C++ collections in general) scalably.