Once I worked on a C++ program and when we really had to optimize, I did some profiling with valgrind. It turned out more than 50% of the CPU time was spend with memory allocations...
However with C++ it's easy to work around that by using pointers or (const) references. Or even one step further one can use a memory pooler or GC.
However with C++ it's easy to work around that by using pointers or (const) references. Or even one step further one can use a memory pooler or GC.