Optimizations

Premature and/or over-optimization is often claimed to be a root of most evil in the programming world. However, what to do when optimization IS necessary?

IT Hares discuss certain not-so-trivial optimization techniques. It doesn’t mean that you should use them at all costs (and most likely, you don’t); however, if you do have a reason to optimize – this information may be handy.

Infographics: Operation Costs in CPU Clock Cycles, Take 2

June 19, 2026 by “No Bugs” Bunny

Quote

The cost of thread context switch, including cache invalidation, can reach up to 3 million CPU cycles

Another Quote

RTTI can be quite expensive, with dynamic_cast<> being up to 5x more expensive than a simple virtual function call

Filed under: On.ProgrammingOptimizations

Tagged With: C/C++
Read more

Testing Memory Allocators: ptmalloc2 vs tcmalloc vs hoard vs jemalloc While Trying to Simulate Real-World Loads

July 4, 2018 by “No Bugs” Bunny

malloc-cpu.png

Quote:

if you DO want to get performance from changing mallocs, make sure to test them with your own app

Another Quote:

in our humble opinion, overall winner so far (by a nose) is jemalloc.

Filed under: On.ProgrammingOptimizations

Read more

The Curse of External Fragmentation: Relocate or Bust!

June 21, 2018 by “No Bugs” Bunny

freed_pages_32_and_128_per_page.png

Quote:

We won’t ever get (almost) any virtual memory back, plain and simple

Another Quote:

relocation allows not only to reduce fragmentation, but to eliminate it entirely.

Filed under: On.ProgrammingOptimizations

Read more

‘Speedy Gonzales’ Serializing (Re)Actors via Allocators

May 1, 2018 by “No Bugs” Bunny

Serializing Allocators

Quote:

Allocator-based serialization for (Re)Actors is extremely fast (for x64 – around tens of ms per 100MB of state)

Another Quote:

Per-(Re)Actor allocators can be implemented without any changes within (Re)Actor itself (i.e. all the necessary changes can be confined to Infrastructure Code).

Filed under: On.ProgrammingProgramming LanguagesOptimizations

Read more