Articles & Books

C and C++ Profiling Tools -- David Faure

When profiling is a good thing:

C/C++ Profiling Tools

by David Faure

From the article:

This blog will give you a brief overview of profiling C and C++ applications. Additionally, it will lay before you all of the tools available, with the purpose of aiding you in choosing the right tools at the right times...

The Proxy Pattern -- Rainer Grimm

Untitled.pngPlaying the classics, at arm's length...

The Proxy Pattern

by Rainer Grimm

From the article:

A proxy controls access to another object, allowing you to perform additional operations before or after you access the original object. Sound familiar?

Which idiom is characteristic of C++? Right: RAII (Resource Acquisition Is Initialization). RAII is the C++ way to implement the Proxy Pattern. Here are the facts about the Proxy Pattern. ...

Using final in C++ to improve performance -- Niall Cooling

Screenshot_2022-11-16_163427.pngWhen having the "last word" makes stuff go faster...

Using final in C++ to improve performance

by Niall Cooling

From the article:

The final specifier was introduced in C++11 to ensure that either a class or a virtual function cannot be further overridden. However, as we shall investigate, this also allows them to perform an optimization known as devirtualization, improving runtime performance.

 

For Software Performance, the Way Data is Accessed Matters! -- Ivica Bogosavljević

Screenshot_2022-11-12_150618.pngAs Crocodile Dundee famously said, "That's not a loop, that's a loop." Just programmers having fun:

For Software Performance, the Way Data is Accessed Matters!

by Ivica Bogosavljević

From the article:

In our experiments with the memory access pattern, we have seen that good data locality is a key to good software performance. Accessing memory sequentially and splitting the data set into small-sized pieces which are processed individually improves data locality and software speed.

In this post, we will present a few techniques to improve the memory access pattern and increase data locality. The advantage of this approach is that the changes are localized in the algorithm itself, i.e. there is no need to change the data layout or the memory layout. The disadvantage is that the algorithms often become more difficult to understand and modify. ...

[... and deep inside the article ...]

Notice that, because the whole cache line is brought from the memory to the data cache, after accessing a[j][i] we can access a[j][i + 1]cheaply, since these two pieces of data belong to the same cache line. The problem in our case is that if n is large, access to a[j][i + 1] will come much after a[j][i] and by that time a[j][i + 1] will be evicted from the data cache. ...

The Facade Pattern -- Rainer Grimm

Untitled.pngPlaying the classics...

The Facade Pattern

by Rainer Grimm

From the article:

The key idea of the Facade Pattern is to provide a simplified interface to a complex system... 

The Facade Pattern is an ideal starting point for decoupling complex systems by introducing layers. Additionally, it can be used as a starting point for deprecating the old interface.

Here are the facts. ...

Improving my C++ time queue -- Marius Elvert

Tick, tock...

Improving my C++ time queue

by Marius Elvert

From the article:

Another code snippet that can be found in a few of my projects is the “time queue”, which is a simple ‘priority queue’ style data structure that I use to defer actions to a later time. ...