Which Container Should I Use?
In this paper we present results of performance testing we performed on three containers from the standard library: vector , map and unordered_map . The goal of this work is to make practical guidelines in order to help programmers choose the right container for a particular use case. We made a series of tests that resembles different circumstances that can come in real world applications. In order to make better conclusions, tests were performed on four different computer configurations and processors. Our initial hypothesis is that the performance of containers not only depends on their general complexity that is a consequence of their internal design and algorithms as such, but should additionally be connected to cache utilization. After analysis of the results obtained, we made several conclusions in terms of better use of C++ containers in particular use cases.
- 1.Malik, D.S.: Data structures using C. Course Technology/Cengage Learning India (2012)Google Scholar
- 3.Irazoqui, G., Eisenbarth, T., Sunar, B.: Systematic reverse engineering of cache slice selection in Intel processors. In: 2015 Euromicro Conference on Digital System Design (2015)Google Scholar
- 4.Truong, D., Bodin, F., Seznec, A.: Improving cache behavior of dynamically allocated data structures. In: Proceedings of 1998 International Conference on Parallel Architectures and Compilation Techniques (Cat. No. 98EX192) (1998)Google Scholar
- 5.Adcock, C.M.S.: Improving cache performance by runtime data movement. University of Cambridge (2009)Google Scholar
- 8.Josuttis, N.M.: The C Standard Library: A Tutorial and Reference. Addison-Wesley, Boston (2015)Google Scholar
- 9.CPU-World: Intel Core i7-3610QM specifications. http://www.cpu-world.com/CPUs/Core_i7/Intel-Core%20i7-3610QM%20Mobile%20processor.html
- 10.CPU-World: Intel Core i5-3337U specifications. http://www.cpu-world.com/CPUs/Core_i5/Intel-Core%20i5-3337U%20Mobile%20processor.html
- 11.CPU-World: Intel Pentium M 740 (Socket 479) specifications. http://www.cpu-world.com/CPUs/Pentium_M/Intel-Pentium%20M%20740%20RH80536GE0302M%20(BX80536GE1733FJ).html
- 12.CPU-World: AMD Athlon 64 TF-20 specifications. http://www.cpu-world.com/CPUs/K8/AMD-Athlon%2064%20TF-20%20-%20AMGTF20HAX4DN.html