How fast are Linux pipes anyway?
Pipes are ubiquitous in Unix --- but how fast can they go on Linux? In this post we'll iteratively improve a simple pipe-writing benchmark from 3.5GiB/s to 65GiB/s, guided by Linux `perf`.
Visit mazzo.li → RSS feedOn Hacker News May 2021 – Oct 2025
Systems & Performance 6Software Engineering 4Math & Algorithms 3Society, Policy & Culture 1Security & Privacy 1Networking & Internet 1
Pipes are ubiquitous in Unix --- but how fast can they go on Linux? In this post we'll iteratively improve a simple pipe-writing benchmark from 3.5GiB/s to 65GiB/s, guided by Linux `perf`.
If we have a heuristic to guess some value cheaply, we can remove a data dependency in a tight loop using the branch predictor. This allows the CPU to run more instructions in parallel, increasing performance. If this explanation does not make much sense to you, keep reading to learn about some of the magic making…
`atan2f` is an important but slow trigonometric function. In this article we'll explain how to approximate it, and implement a version 50x faster than `glibc` on batches of inputs.
Stopping a Linux thread is a surprisingly annoying affair. In this post I present common pitfalls and some solutions -- although no truly satisfactory method exists.
Addendum : Many Hacker News commenters correctly point out that the right way to indicate to the compiler that a value does not change is const . This post is not about C best practices, but just about how one can easily get to the bottom of this kind of surprising behavior by looking at the compiler output. This…
TL;DR: If you live in the EU or are a EU citizen, companies must provide personal data you provided or they collected in a machine-readable format, following the article 20 of the GDPR.
Let’s say we want to store some data on multiple drives, so that we can recover from drive failures.
When you resize, rotate, or in any way transform an image; or more generally when you resample some discrete signal, the software you are using must _interpolate_ between the discrete points to produce a result. Linear and cubic interpolation are easy to explain, but Lánczos interpolation, one of the most popular…
When doing systems programming we often need to wait for something to happen. Common examples might be waiting for some data to come through a socket or waiting on a lock. We also often want to wait on any of several conditions to become true. A web server might be handling many sockets at once, waiting for any number…