performance

C++20: Heterogeneous Lookup in (Un)ordered Containers--Bartlomiej Filipek

Did you know?

C++20: Heterogeneous Lookup in (Un)ordered Containers

by Bartlomiej Filipek

From the article:

Would you like to gain 20…35 or even 50% speed improvements when searching in associative containers? In this blog post, we’ll explore a technique called “heterogenous access” that offers such impressive speedups. We’ll explore ordered containers, and the support for unordered collections added recently in C++20...

Three reasons to pass std::string_view by value--Arthur O’Dwyer

You should.

Three reasons to pass std::string_view by value

by Arthur O’Dwyer

From the article:

It is idiomatic to pass std::string_view by value. Let’s see why.

First, a little background recap. In C++, everything defaults to pass-by-value; when you say Widget w you actually get a whole new Widget object. But copying big things can be expensive. So we introduce “pass-by-const-reference” as an optimization of “pass-by-value,” and we tell people to pass big and/or expensive things like std::string by const reference instead of by value.

But for small cheap things — int, char*, std::pair<int, int>, std::span<Widget> — we continue to prefer the sensible default behavior of pass-by-value.

Pass-by-value has at least three performance benefits over pass-by-(const)-reference. I’ll illustrate all three of them via string_view...

C++ String Benchmark -- Giovanni Dicanio

This small article compares different string implementations on the Windows platform.

C++ String Benchmark: STL vs. ATL vs. Custom Pool Allocator

by Giovanni Dicanio

From the article:

I was curious to compare the performance of the STL string implementation versus ATL CString, using Visual Studio 2019, so I wrote some simple C++ benchmark code for this purpose. I also added into the mix a custom string pool allocator.

 

HPX V1.7.1 released -- STE||AR Group

The STE||AR Group has released V1.7.1 of HPX -- A C++ Standard library for parallelism and concurrency.

HPX V1.7.1 Released

The newest version of HPX (V1.7.1) is now available for download! This release fixes minor problems found after the version 1.7.0. It fixes a bug in the internals of actions, adds a version check to the new Asio dependency, and slightly improves the performance of spinlocks among other minor changes. Importantly, the experimental hpx::execution::simdpar execution policy introduced in 1.7.0 was renamed to hpx::execution::par_simd for consistency with the standard parallel execution policies. While this is a breaking change in a patch release, we felt it was important to make this adaptation as soon as possible. The full list of improvements, fixes, and breaking changes can be found in the release notes.

    HPX is a general purpose parallel C++ runtime system for applications of any scale. It implements all of the related facilities as defined by the C++ Standard. As of this writing, HPX provides one of the only widely available open-source implementation of the new C++17 parallel algorithms. Additionally, HPX implements functionalities proposed as part of the ongoing C++ standardization process, such as large parts of the features related parallelism and concurrency as specified by the upcoming C++20 Standard, the C++ Concurrency TS, Parallelism TS V2, data-parallel algorithms, executors, senders/receivers and many more. It also extends the existing C++ Standard APIs to the distributed case (e.g. compute clusters) and for heterogeneous systems (e.g. GPUs).

    HPX seamlessly enables a new Asynchronous C++ Standard Programming Model that tends to improve the parallel efficiency of our applications and helps reducing complexities usually associated with parallelism and concurrency.

 

How to Parallelise CSV Reader - C++17 in Practice--Bartlomiej Filipek

Would do it the same way?

How to Parallelise CSV Reader - C++17 in Practice

by Bartlomiej Filipek

Friom the article:

At C++Stories (and in my C++17 book) you can find several articles on Parallel Algorithms introduced in C++17. The examples included in those posts were usually relatively straightforward. How about writing something larger?

In this text, you’ll see how to build a tool that works on CSV files, parses lines into sales records and then performs calculations on the data.

You’ll see how easy it is to add parallel execution to selected algorithms and have a performance improvement across the whole application (for example 4.5x on 6 cores, including file loading). In the end, we’ll discuss problems that we found along the way and possible future enhancements.

Here’s the plan:

  • How to build an application that loads CSV files
  • How to efficiently use parallel algorithms
  • How to use std::filesystem library to gather required files
  • How to use other C++17 library features like std::optional, conversion routines - std::from_chars and string_view
  • Where to add [[nodiscard]] and improve code readability

Let’s go...

Using C++ Modules in MSVC from the Command Line Part 1--Cameron DaCamara

Time to get familiar!

Using C++ Modules in MSVC from the Command Line Part 1

by Cameron DaCamara

From the article:

In this three-part series we will explore how to build modules and header units from the command line as well as how to use/reference them.

The goal of this post is to serve as a brief tour of compiling and using primary module interfaces from the command line and the options we use...