Skip to main content

One post tagged with "optimization"

View All Tags

· 7 min read
Hreniuc Cristian-Alexandru

How much faster it is to have a vector of objects instead of pointers.

Compile the code from below and run it:

g++ -std=c++17 -O3 -g -o exe main.cpp

Ussage: ./exe iterations entries_per_vector no_tests [shared_ptr|object] [pre-allocated]

☰ dockerfile ⑂master_interactive* ♦ gcc --version
gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008

Not prealocated: - Storing a vector of objects is 2 times faster.