Click here to Skip to main content
15,891,693 members
Articles / Programming Languages / C++

STL: Amazing Speed Differences between std::vector and std::set (Observed with an UndoRedoAction).

Rate me:
Please Sign up or sign in to vote.
3.88/5 (5 votes)
2 Jun 2021CPOL4 min read 14.7K   7  
Why replacing std::vector with std::set sped up my UndoRedoAction class by about 20x
When using STL element containers, selecting the container type that suits the intended use is of major importance for the processing speed. If the amount of read operations significantly exceeds the amount of write operations, it is worth using std::set compared to std::vector.

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader Celonis SA
Germany Germany
I am currently the CEO of Symbioworld GmbH and as such responsible for personnel management, information security, data protection and certifications. Furthermore, as a senior programmer, I am responsible for the automatic layout engine, the simulation (Activity Based Costing), the automatic creation of Word/RTF reports and the data transformation in complex migration projects.

The main focus of my work as a programmer is the development of Microsoft Azure Services using C# and Visual Studio.

Privately, I am interested in C++ and Linux in addition to C#. I like the approach of open source software and like to support OSS with own contributions.

Comments and Discussions