Articles & Books

Optimizing C++ Code with O(1) Operations -- Giovanni Dicanio

Continuing from the previous Adventures with string_view post, in this new article I show how you can achieve massive performance gains using code characterized by O(1) constant-time asymptotic complexity.

Adventures with string_view: Optimizing Code with O(1) Operations

by Giovanni Dicanio

From the article:

While this code works fine, it’s possible to optimize it.

As the saying goes, first make things work, then make things fast.

Replacing a O(N) operation with a O(1) operation in this case gives a performance boost of 88 ms vs. 445 ms, which is an 80% performance gain!

 

C++20 Coroutines back to basics — Restrictions and rules for legal coroutines--Gajendra Gulgulia

Surprising but useful.

C++20 Coroutines back to basics — Restrictions and rules for legal coroutines

by Gajendra Gulgulia

From the article:

In my previous articles on coroutines, I attempted to explain the mechanics of coroutine suspension, resuming it, promise_type, awaiters and awaitables. In this article, I would like to answer two very basic questions:

  • What are the restrictions on coroutines ?
  • When can a coroutine usage be legal in terms of member, non-member functions of class/structs, lambda expressions and so on ?

Local Time--Andrzej Krzemieński

Correct time tables.

Local Time

by Andrzej Krzemieński

From the article:

In this post we will see how to solve the task from the previous post, but display the time point in local time instead of system time. The solution is simple and takes only two additional lines (you can scroll down towards the end), but I want to take this opportunity to offer some reflections about the concepts of time zones and daylight saving time...

Policy--Rainer Grimm

The series continue.

Policy

by Rainer Grimm

From the article:

Thanks to templates, there are new ways of software design. Policies and traits are two commonly used idioms in C++.

OVERLOAD JOURNAL 168 - APRIL 2022

The new Overload is out.

OVERLOAD JOURNAL 168 - APRIL 2022

In the journal:

On Becoming Unstuck
By Frances Buontempo
The horsemen of the apocalypse may be on the horizon. Frances Buontempo attempts to stop doom-scrolling and solve problems instead.

Taming Wordle with the Command Line
By James Handley
Could static analysis provide a generic way to approach Wordle? James Handley uses simple command line tools in order to (hopefully) name that Wordle in four!

C++20: A Coroutine Based Stream Parser
By Andreas Fertig
Stream parsing code can be very complicated. Andreas Fertig uses coroutines to make stream parsing code clearer.

Structured Concurrency in C++
By Lucian Radu Teodorescu
Raw threads tend to be unstructured. Lucian Radu Teodorescu applies principles from Structured Programming to concurrency.

The Vector Refactored
By Teedy Deigh
Finding the right level of abstraction can be challenging. Teedy Deigh razes the level of abstraction.