Advertisement

Which Container Should I Use?

  • Esmira MuslijaEmail author
  • Edin Pjanić
Conference paper
Part of the Lecture Notes in Networks and Systems book series (LNNS, volume 59)

Abstract

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.

References

  1. 1.
    Malik, D.S.: Data structures using C. Course Technology/Cengage Learning India (2012)Google Scholar
  2. 2.
    Cormen, T.H., Leiserson, C.E.: Introduction to Algorithms, 3rd edn. The MIT Press, Cambridge (2009)zbMATHGoogle Scholar
  3. 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. 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. 5.
    Adcock, C.M.S.: Improving cache performance by runtime data movement. University of Cambridge (2009)Google Scholar
  6. 6.
    Dudziak, T., Herter, J.: Cache analysis in presence of pointer-based data structures. ACM SIGBED Rev. 8, 7–10 (2011)CrossRefGoogle Scholar
  7. 7.
    Larus, J., Hill, M., Chilimbi, T.: Making pointer-based data structures cache conscious. Computer 33, 67–74 (2000)CrossRefGoogle Scholar
  8. 8.
    Josuttis, N.M.: The C Standard Library: A Tutorial and Reference. Addison-Wesley, Boston (2015)Google Scholar
  9. 9.
  10. 10.
  11. 11.
  12. 12.

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.Faculty of Electrical EngineeringUniversity of TuzlaTuzlaBosnia and Herzegovina

Personalised recommendations