Comparing implementations of std::string

Highly recommended reading for C++ developers: An informal comparison of the three major implementations of std::string (discussed on Reddit and Hacker News), which goes into how std::string is implemented by the 3 major compilers: GCC (libstdc++), MSVC, and Clang (libc++), and what design choices …

93% of Paint Splatters are Valid Perl Programs

93% of Paint Splatters are Valid Perl Programs (discussed on Hacker News) made me laugh, it is the kind of high-quality trolling that the field of computer science could definitely use more of. It is actually a scientific paper accepted by the SIGBOVIK 2019 conference, and that is glorious. In this …

The Wisdom of James Mickens

I am here to talk to you non-believers about The Wisdom of James Mickens. At least those of you who are software developers or would vaguely identify yourselves as “computer scientists”, whatever that might mean. James Mickens offers his timeless insights for free, because he loves you …

Arguing against accessor functions

One of the unpopular opinions I’ve long held in programming is that accessor methods (getters and setters) are a terrible practice. Now that I have found somebody who agrees with me (timestamps 1:13:06 to 1:16:25) I am ready to write about this! This is what I mean (C++ code, but the same …

Implementing order books in C++ and Rust - part 3/3

In the previous part we have started working on our Rust orderbook re-implementation of the C++ original, and defined the types Order and OrderKey<Side>, where Side is a type implementing the OrderbookSide trait: either Bid (for buy orders) or Ask (for sell orders). Defining OrderHandle …

Configuration knobs considered harmful (Abseil blog)

I found the recent Abseil article Performance Tip of the Week #52: Configuration knobs considered harmful to be insightful. Most people, developers included, would generally prefer more flexibility and configurability over less, but as the article points out, configuration options (flags) carry …

Graphs are hard

The Hunt for the Missing Data Type (discussion on Hacker News) is an article exploring why are graph implementations so rare while graph problems are so common: I see graphs everywhere and use them to analyze all sorts of systems. At the same time, I dread actually using graphs in my code. There is …

Implementing order books in C++ and Rust - part 2/3

In the previous part, we have sketched out the structure of implementing a simple order book in C++, supporting order insertion and efficient cancellation. (Implementing uncrossing, that is, trades when a buy order and a sell order agree on a price, is an exercise left to the reader, as is …

Implementing order books in C++ and Rust - part 1/3

A fairly standard programming problem in the world of trading is building an order book. In this article, I will be showing one particular interesting aspect of this problem, and how to solve it in C++. In the next two parts, we will be trying to implement the same solution in Rust. This is meant to …

Rust oddness: integer literal references?

I’m following Rust by Example to finally get into Rust properly, after several years spent as a primarily C++ developer. So far, most things have made sense to me, and I have been blown away by the compiler diagnostics: they are accurate and useful, which anybody with some C++ experience will …

Passing a struct of 3 or more words is slow on AMD64

I did not realize that the AMD64 ABI specifies a silly calling convention rule that forces structs with 3 or more word-sized (i.e. 8-byte) fields to be passed by pointer, even if you write your code expecting to have it be passed by value. I learned this from: Speed up your code: don’t pass …

Measuring work performance

In The value of your work I have talked about how in a job, work is useful for your individual career only if your manager deems it so, even though that is not always the same thing as what is valuable for your team or your organization. In fact, it is rather difficult to come up with a good, …

The frame pointers strike back

Interesting: Ubuntu 24.04 LTS will enable frame pointers by default, following Fedora which made the same change in version 38. In short: GCC will by default start emitting frame pointers again as if using -fno-omit-frame-pointer, which helps debugging and profiling tools a bit, at the cost of what …

The value of your work

2023-12-14 Work is valued if and only if it is something that management (or whoever evaluates your performance) cares about, which does not necessarily have to be in any way related to how much real value it provides. Have you fixed a bug or introduced a feature that helps every software developer …

Recovering from segmentation faults

This is brilliant: Cleanly recovering from Segfaults under Windows and Linux (32-bit, x86). I do not think I’d want to actually use this in production, for the same reason that the article itself points out: segmentation faults often indicate that something has gone horribly wrong inside the …

C++ vs Rust: performance vs safety

I was reading Why I think C++ is still a desirable coding platform compared to Rust on Low Latency Trading Insights, and wanted to share my thoughts. Overall, I really appreciate this article: it raises a very important subject and makes lots of good points. I do disagree with some of it, though I …

C++ language philosophy

C++ is one of the oldest mainstream programming languages in use today, and also easily one of the most controversial ones: some people love it (including myself), but if you read any online forums, you’d easily be under the impression that most people despise it. The criticisms are, more …

Simultaneous multi-threading: priority signalling

I’ve encountered a statement today in a random blog post about the IBM PowerPC 600 series that broke my brain for a minute while I was trying to figure out what it could possibly have meant, so now I’m going to subject you to it as well. Here goes: Moving a register to itself is …

A guide to error-handling

Error-handling is a heavily debated topic. Generally speaking, the following mechanisms exist to handle errors when implementing a function: Return something to indicate the error: an error code, a sentinel value (like NaN), or using a result-or-error type (like C++’s std::expected or …

PRQL: it's like SQL but actually makes sense

I have never had to write particularly complex SQL queries, but I’ve written and seen enough to know that that SQL gets nasty and complicated once you start using the non-trivial features, not to mention things like optimizing queries based on the execution plan, or optimizing indexes, or the …

It's turtles all the way down: from high-level programming to CPU microcode

It’s turtles all the way down: The following anecdote is told of William James. […] After a lecture on cosmology and the structure of the solar system, James was accosted by a little old lady. “Your theory that the sun is the centre of the solar system, and the earth is a ball …

Out-of-memory while trying to free it: into virtual memory

I recently came by this fun story on getting an out-of-memory error on Linux when trying to free memory: Production postmortem: ENOMEM when trying to free memory That error made absolutely no sense, as you can imagine. We are trying to release memory, not allocate it. Common sense says that you …