# Denis Bakhvalov

Performance optimizations and analysis in C/C++

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Thread Count Scaling Part 5. Summary

DevFeed: [Thread Count Scaling Part 5. Summary](<https://devfeed.tech/articles/thread-count-scaling-part-5-summary-13644.md>)

Original publisher: [Read original article](<https://easyperf.net/blog/2024/05/10/Thread-Count-Scaling-Part5>)

Author: Denis Bakhvalov

Published: 2024-05-10T04:00:00Z

Content type: article

Language: en

Sources: [Denis Bakhvalov](<https://devfeed.tech/sources/denis-bakhvalov.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [benchmarking](<https://devfeed.tech/topics/benchmarking.md>), [cpu](<https://devfeed.tech/topics/cpu.md>), [Hardware](<https://devfeed.tech/topics/hardware.md>), [Caching](<https://devfeed.tech/topics/caching.md>), [Deadlock](<https://devfeed.tech/topics/deadlock.md>)

Tags: [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [book-chapters](<https://devfeed.tech/tags/book-chapters.md>), [cache](<https://devfeed.tech/tags/cache.md>), [concurrent](<https://devfeed.tech/tags/concurrent.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [hardware](<https://devfeed.tech/tags/hardware.md>), [performance](<https://devfeed.tech/tags/performance.md>), [performance-analysis](<https://devfeed.tech/tags/performance-analysis.md>), [thread](<https://devfeed.tech/tags/thread.md>), [threads](<https://devfeed.tech/tags/threads.md>)

### AI overview

This summary reviews thread-count scaling in throughput-oriented applications. It identifies frequency throttling, differences between performant and energy-efficient cores, shared-resource limits such as memory bandwidth and L3 cache, and thread synchronization as factors that can limit scaling. It also references SPEC CPU 2017 benchmarks and reports differing scaling behavior for integer and floating-point workloads.

### Source excerpt

Subscribe to my newsletter, support me on Patreon, Github, or by PayPal donation. This blog is an excerpt from the book. More details in the introduction. Summary In the case study, we have analyzed several throughput-oriented applications with varying thread count scaling characteristics. Here is a quick summary of our findings: - Frequency throttling is a major roadblock to achieving good thread count scaling. This affects all the benchmarks that we've analyzed.

## Thread Count Scaling Part 2. Blender and Clang

DevFeed: [Thread Count Scaling Part 2. Blender and Clang](<https://devfeed.tech/articles/thread-count-scaling-part-2-blender-and-clang-13641.md>)

Original publisher: [Read original article](<https://easyperf.net/blog/2024/05/10/Thread-Count-Scaling-Part2>)

Author: Denis Bakhvalov

Published: 2024-05-10T04:00:00Z

Content type: article

Language: en

Sources: [Denis Bakhvalov](<https://devfeed.tech/sources/denis-bakhvalov.md>)

Topics: [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [benchmarking](<https://devfeed.tech/topics/benchmarking.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Processes](<https://devfeed.tech/topics/processes.md>)

Tags: [benchmark](<https://devfeed.tech/tags/benchmark.md>), [blender](<https://devfeed.tech/tags/blender.md>), [book-chapters](<https://devfeed.tech/tags/book-chapters.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [clang](<https://devfeed.tech/tags/clang.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [parallel](<https://devfeed.tech/tags/parallel.md>), [parallelism](<https://devfeed.tech/tags/parallelism.md>), [performance](<https://devfeed.tech/tags/performance.md>), [performance-analysis](<https://devfeed.tech/tags/performance-analysis.md>), [process](<https://devfeed.tech/tags/process.md>), [scale](<https://devfeed.tech/tags/scale.md>), [thread](<https://devfeed.tech/tags/thread.md>), [threads](<https://devfeed.tech/tags/threads.md>)

### AI overview

This article examines thread-count scaling in Blender and Clang. Blender scales across the available threads because its rendering workload is highly parallelizable, but scaling declines as E-cores and SMT sibling threads are used. Clang compilation is also massively parallel, though its scaling is affected by cache and branch behavior, core differences, SMT, and frequency throttling.

### Source excerpt

Subscribe to my newsletter, support me on Patreon, Github, or by PayPal donation. This blog is an excerpt from the book. More details in the introduction. Blender is the only benchmark in our suite that continues to scale up to all 16 threads in the system. The reason for this is that the workload is highly parallelizable. The rendering process is divided into small tiles, and each tile can be rendered independently. However, even with this high level of parallelism, the scaling is only .

## Thread Count Scaling Part 4. CloverLeaf and CPython

DevFeed: [Thread Count Scaling Part 4. CloverLeaf and CPython](<https://devfeed.tech/articles/thread-count-scaling-part-4-cloverleaf-and-cpython-13643.md>)

Original publisher: [Read original article](<https://easyperf.net/blog/2024/05/10/Thread-Count-Scaling-Part4>)

Author: Denis Bakhvalov

Published: 2024-05-10T04:00:00Z

Content type: article

Language: en

Sources: [Denis Bakhvalov](<https://devfeed.tech/sources/denis-bakhvalov.md>)

Topics: [benchmarking](<https://devfeed.tech/topics/benchmarking.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>)

Tags: [book-chapters](<https://devfeed.tech/tags/book-chapters.md>), [case-study](<https://devfeed.tech/tags/case-study.md>), [dram](<https://devfeed.tech/tags/dram.md>), [hpc](<https://devfeed.tech/tags/hpc.md>), [memory](<https://devfeed.tech/tags/memory.md>), [metric](<https://devfeed.tech/tags/metric.md>), [performance](<https://devfeed.tech/tags/performance.md>), [performance-analysis](<https://devfeed.tech/tags/performance-analysis.md>), [scale](<https://devfeed.tech/tags/scale.md>), [speed](<https://devfeed.tech/tags/speed.md>), [thread](<https://devfeed.tech/tags/thread.md>)

### AI overview

The article examines CloverLeaf and CPython thread-count scaling. It reports that CloverLeaf performance stops increasing after three threads because memory bandwidth becomes the limiting factor. Replacing two memory modules with faster DDR4 modules improves performance by 10% to 33% as thread count increases.

### Source excerpt

Subscribe to my newsletter, support me on Patreon, Github, or by PayPal donation. This blog is an excerpt from the book. More details in the introduction. CloverLeaf is a hydrodynamics workload. We will not dig deep into the details of the underlying algorithm as it is not relevant to this case study. CloverLeaf uses OpenMP to parallelize the workload. Similar to other HPC workloads, we should expect CloverLeaf to scale well.

## Thread Count Scaling Part 3. Zstandard

DevFeed: [Thread Count Scaling Part 3. Zstandard](<https://devfeed.tech/articles/thread-count-scaling-part-3-zstandard-13642.md>)

Original publisher: [Read original article](<https://easyperf.net/blog/2024/05/10/Thread-Count-Scaling-Part3>)

Author: Denis Bakhvalov

Published: 2024-05-10T04:00:00Z

Content type: article

Language: en

Sources: [Denis Bakhvalov](<https://devfeed.tech/sources/denis-bakhvalov.md>)

Topics: [Compression](<https://devfeed.tech/topics/compression.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [book-chapters](<https://devfeed.tech/tags/book-chapters.md>), [case-study](<https://devfeed.tech/tags/case-study.md>), [compression](<https://devfeed.tech/tags/compression.md>), [fragmentation](<https://devfeed.tech/tags/fragmentation.md>), [memory](<https://devfeed.tech/tags/memory.md>), [memory-pool](<https://devfeed.tech/tags/memory-pool.md>), [performance](<https://devfeed.tech/tags/performance.md>), [performance-analysis](<https://devfeed.tech/tags/performance-analysis.md>), [thread](<https://devfeed.tech/tags/thread.md>), [threads](<https://devfeed.tech/tags/threads.md>)

### AI overview

This article examines why Zstandard compression does not scale linearly with thread count. It discusses compression-level trade-offs, worker-thread interactions, waiting periods, input-buffer shortages, and memory-pool fragmentation, based on an instrumented timeline.

### Source excerpt

Subscribe to my newsletter, support me on Patreon, Github, or by PayPal donation. This blog is an excerpt from the book. More details in the introduction. Next on our list is the Zstandard compression algorithm, or Zstd for short. When compressing data, Zstd divides the input into blocks, and each block can be compressed independently. This means that multiple threads can work on compressing different blocks simultaneously.

## Thread Count Scaling Part 1. Introduction

DevFeed: [Thread Count Scaling Part 1. Introduction](<https://devfeed.tech/articles/thread-count-scaling-part-1-introduction-13640.md>)

Original publisher: [Read original article](<https://easyperf.net/blog/2024/05/10/Thread-Count-Scaling-Part1>)

Author: Denis Bakhvalov

Published: 2024-05-10T04:00:00Z

Content type: tutorial

Language: en

Sources: [Denis Bakhvalov](<https://devfeed.tech/sources/denis-bakhvalov.md>)

Topics: [Scalability](<https://devfeed.tech/topics/scalability.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [systems](<https://devfeed.tech/topics/systems.md>), [Linux](<https://devfeed.tech/topics/linux.md>)

Tags: [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [book-chapters](<https://devfeed.tech/tags/book-chapters.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [case-study](<https://devfeed.tech/tags/case-study.md>), [linux](<https://devfeed.tech/tags/linux.md>), [performance-analysis](<https://devfeed.tech/tags/performance-analysis.md>), [scalability](<https://devfeed.tech/tags/scalability.md>), [systems](<https://devfeed.tech/tags/systems.md>)

### AI overview

This case study explains thread count scaling for multithreaded applications. It examines how applications use multicore systems and how hardware configuration and Linux scheduling affect scaling results.

### Source excerpt

Subscribe to my newsletter, support me on Patreon, Github, or by PayPal donation. I would love to hear your feedback! I wrote this blog series for the second edition of my book titled "Performance Analysis and Tuning on Modern CPUs". It is open-sourced on Github: perf-book. The book primarily targets mainstream C and C++ developers who want to learn low-level performance engineering, but devs in other languages may also find a lot of useful information.

## Memory Profiling Part 2. Memory Usage Case Study

DevFeed: [Memory Profiling Part 2. Memory Usage Case Study](<https://devfeed.tech/articles/memory-profiling-part-2-memory-usage-case-study-13637.md>)

Original publisher: [Read original article](<https://easyperf.net/blog/2024/02/12/Memory-Profiling-Part2>)

Author: Denis Bakhvalov

Published: 2024-02-12T05:00:00Z

Content type: tutorial

Language: en

Sources: [Denis Bakhvalov](<https://devfeed.tech/sources/denis-bakhvalov.md>)

Topics: [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Ubuntu](<https://devfeed.tech/topics/ubuntu.md>), [Windows](<https://devfeed.tech/topics/windows.md>), [cpu](<https://devfeed.tech/topics/cpu.md>), [intel](<https://devfeed.tech/topics/intel.md>)

Tags: [benchmark](<https://devfeed.tech/tags/benchmark.md>), [book-chapters](<https://devfeed.tech/tags/book-chapters.md>), [case-study](<https://devfeed.tech/tags/case-study.md>), [intel](<https://devfeed.tech/tags/intel.md>), [linux](<https://devfeed.tech/tags/linux.md>), [performance-analysis](<https://devfeed.tech/tags/performance-analysis.md>), [processor](<https://devfeed.tech/tags/processor.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [ubuntu](<https://devfeed.tech/tags/ubuntu.md>), [windows](<https://devfeed.tech/tags/windows.md>)

### AI overview

This article presents a memory-usage case study of Stockfish's built-in benchmark using heaptrack on Linux, with comparisons to Mtuner on Windows. It examines memory consumption and allocation patterns, including long-lived and temporary allocations.

### Source excerpt

Subscribe to my newsletter, support me on Patreon or by PayPal donation. Now, let's take a look at how to profile the memory usage of a real-world application. We will use heaptrack, an open-sourced heap memory profiler for Linux developed by KDE. Ubuntu users can install it very easily with . Heaptrack can find places in the code where the largest and most frequent allocations happen among many other things. On Windows, you can use Mtuner which has similar1 capabilities as Heaptrack.

## Memory Profiling Part 3. Memory Footprint with SDE

DevFeed: [Memory Profiling Part 3. Memory Footprint with SDE](<https://devfeed.tech/articles/memory-profiling-part-3-memory-footprint-with-sde-13638.md>)

Original publisher: [Read original article](<https://easyperf.net/blog/2024/02/12/Memory-Profiling-Part3>)

Author: Denis Bakhvalov

Published: 2024-02-12T05:00:00Z

Content type: tutorial

Language: en

Sources: [Denis Bakhvalov](<https://devfeed.tech/sources/denis-bakhvalov.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [Cache](<https://devfeed.tech/topics/cache.md>), [Instrumentation](<https://devfeed.tech/topics/instrumentation.md>), [Emulator](<https://devfeed.tech/topics/emulator.md>), [x86](<https://devfeed.tech/topics/x86.md>), [Software](<https://devfeed.tech/topics/software.md>)

Tags: [book-chapters](<https://devfeed.tech/tags/book-chapters.md>), [cache](<https://devfeed.tech/tags/cache.md>), [code](<https://devfeed.tech/tags/code.md>), [emulator](<https://devfeed.tech/tags/emulator.md>), [instrumentation](<https://devfeed.tech/tags/instrumentation.md>), [performance-analysis](<https://devfeed.tech/tags/performance-analysis.md>), [software](<https://devfeed.tech/tags/software.md>), [x86](<https://devfeed.tech/tags/x86.md>)

### AI overview

This tutorial explains how to estimate the memory footprint of a simple 4Kx4K matrix multiplication program. It compares naive matrix multiplication with a loop-interchanged version that improves memory access by preserving row-major traversal, then introduces Intel SDE for measurement while noting its substantial runtime cost.

### Source excerpt

Subscribe to my newsletter, support me on Patreon or by PayPal donation. Now let's take a look at how we can estimate the memory footprint. In part 3, we will warm up by measuring the memory footprint of a simple program. In part 4, we will examine the memory footprint of four production workloads. Consider a simple naive matrix multiplication code presented in the listing below on the left. The code multiplies two square 4Kx4K matrices and and writes the result into square 4Kx4K matrix .

## Memory Profiling Part 4. Memory Footprint Case Study

DevFeed: [Memory Profiling Part 4. Memory Footprint Case Study](<https://devfeed.tech/articles/memory-profiling-part-4-memory-footprint-case-study-13639.md>)

Original publisher: [Read original article](<https://easyperf.net/blog/2024/02/12/Memory-Profiling-Part4>)

Author: Denis Bakhvalov

Published: 2024-02-12T05:00:00Z

Content type: article

Language: en

Sources: [Denis Bakhvalov](<https://devfeed.tech/sources/denis-bakhvalov.md>)

Topics: [intel](<https://devfeed.tech/topics/intel.md>), [benchmarking](<https://devfeed.tech/topics/benchmarking.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [Ray Tracing](<https://devfeed.tech/topics/ray-tracing.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [applications](<https://devfeed.tech/tags/applications.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [book-chapters](<https://devfeed.tech/tags/book-chapters.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [intel](<https://devfeed.tech/tags/intel.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [performance-analysis](<https://devfeed.tech/tags/performance-analysis.md>), [production](<https://devfeed.tech/tags/production.md>), [ray-tracing](<https://devfeed.tech/tags/ray-tracing.md>)

### AI overview

This case study uses Intel SDE to examine the memory footprints of Blender ray tracing, Stockfish, Clang++ compilation, and AI_bench PSPNet segmentation. It compares their behavior over one-billion-instruction intervals and explains how instruction timelines can be approximately converted to seconds using IPC and processor frequency.

### Source excerpt

Subscribe to my newsletter, support me on Patreon or by PayPal donation. In this case study we will use the Intel SDE tool to analyze the memory footprint of four production workloads: Blender ray tracing, Stockfish chess engine, Clang++ compilation, and AI_bench PSPNet segmentation. We hope that this study will give you an intuition of what you could expect to see in real-world applications.