Rendered at 13:51:57 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
egl2020 9 hours ago [-]
Article title should be "Efficient C++ Programming for Modern 64-bit CPUs...".
adrian_b 3 hours ago [-]
Many cost relationships from TFA have already been more or less true for the 32-bit CPUs launched after 1990 and they all became true for the 32-bit high-end CPUs launched after 2000 (like Intel Pentium 4 and AMD Athlon XP), when the difference between the CPU clock frequency and the DRAM latency became almost as high as today.
Only for the 32-bit CPUs used in microcontrollers, which may have clock frequencies under 100 MHz and which may lack a cache hierarchy, the cost differences between many kinds of operations may collapse.
For instance even for not too old 32-bit CPUs it is right to classify the instructions in the following groups, based on their cost in clock cycles:
1. Simple integer operations with operands in registers
2. Loads from the L1 cache memory and simple floating-point operations, like addition and multiplication
3. Loads from the L2 cache memory, division (integer or floating-point), square root and mispredicted branches
4. Loads from the L3 cache memory and atomic read-modify-write operations (like atomic exchange, atomic fetch-and-add, atomic compare-and-swap)
5. Loads from the main memory
This classification matches the chart from TFA.
spwa4 2 hours ago [-]
That's what people don't really understand about CPUs these days. DRAM is stuck on 10nm (and even that was a big effort to move there). The capacitor circuit DRAM uses doesn't work if you reduce the size much more, and so it can't be scaled down, and this is not changing. We're pretty much stuck on memory speed almost regardless of chip advances (at least for the individual chips, but we're already using 8 and 16 and more chips at the same time. Something like for your byte: bit 1 -> chip 1, bit 2 -> chip 2, ... So instantaneous read is not actually reading 8 adjecent memory cells but 1 parallellized read)
Nevermark 5 hours ago [-]
A CPU implementing C++ as a microarchitecture…? Finally, uncontrovertible proof of the prophesy. We really are living in a Cthulhu nightmare.
Simulation theory is dead.
sukuva 4 hours ago [-]
do we have "modern" 32-bit CPUs?
reactordev 4 hours ago [-]
Yes. Yes we do. A lot of them.
avadodin 5 hours ago [-]
That title got me:
Modern C++ CPUs as in LISP CPUs or as in Verilog CPUs?
zombot 9 hours ago [-]
Came here to say exactly that.
notorandit 3 hours ago [-]
C++ CPUs?
reinitctxoffset 7 hours ago [-]
If people are interested in this stuff, this is the house style guide that I've ended up with in mid 2026, its great-great-great grandparents were at Google, which informed Greg Badros and Mark Rabkin and Andrei Alexandrescu when they did the one at FB, which informed a bunch of trading work, which informed a bunch of GPU work.
It links itself to some things that really seem to have existed, like a straylight project linked to the ESA, and an old domain b7r6.net linked to another HN account. There are a lot of buzzwords there, but in aggregate it is nonsense. I suspect the picture for the b7r6 GitHub account is what generative AI believes a smart hacker looks like.
Is this the internet now?
reinitctxoffset 1 hours ago [-]
Let's keep it on the code. What praytell is nonsense buzzwords?
Slightly struck by the concept of hand-writing the config parsing but not, apparently, the documentation...
reinitctxoffset 1 hours ago [-]
That revision of the style guide is expressly written for consumption by agents, it says so in the introduction, so agents edit it whenever they fuck up in C++, that's on purpose.
Just about all the snippets are lightly adapted from shit I wrote before agents were relevant, so any fail in there is on me.
Do you have any errata or just a shitty attitude?
rramadass 6 hours ago [-]
This is Excellent! Thanks for sharing.
First off, i highly suggest that you expand this into a full-blown book. This could become a successor to a combination of {Adrian & Piotr's "Software Architecture with C++" + Fedor Pikus' "The Art of Writing Efficient Programs"} for the Agentic era.
I really like that you are using Lean4 for parts of code generation, tips for Agentic coding etc. which are all needed today. I myself have been thinking on these lines i.e. using formal methods for specification and verification so that agent-generated code can be "correct-by-construction" and efficient. Your write-up is the first i have seen which tries to provide the overall picture.
reinitctxoffset 1 hours ago [-]
Thank you kindly for the kind words. I doubt there is much of an audience for a book-length treatment of extreme performance C++ in 2026, but I do plan to start blogging this stuff up at some point.
Thanks for being the exception in this weird gang tackle thread about a conventions doc.
Tony_Delco 4 hours ago [-]
[dead]
zombot 9 hours ago [-]
This looks like something that every serious C++ programmer should be reading.
Only for the 32-bit CPUs used in microcontrollers, which may have clock frequencies under 100 MHz and which may lack a cache hierarchy, the cost differences between many kinds of operations may collapse.
For instance even for not too old 32-bit CPUs it is right to classify the instructions in the following groups, based on their cost in clock cycles:
1. Simple integer operations with operands in registers
2. Loads from the L1 cache memory and simple floating-point operations, like addition and multiplication
3. Loads from the L2 cache memory, division (integer or floating-point), square root and mispredicted branches
4. Loads from the L3 cache memory and atomic read-modify-write operations (like atomic exchange, atomic fetch-and-add, atomic compare-and-swap)
5. Loads from the main memory
This classification matches the chart from TFA.
Simulation theory is dead.
Modern C++ CPUs as in LISP CPUs or as in Verilog CPUs?
It's opinionated but it has served me well.
https://gist.github.com/b7r6/5dde648f5dc1dea1e9039f2211f5d40...
It links itself to some things that really seem to have existed, like a straylight project linked to the ESA, and an old domain b7r6.net linked to another HN account. There are a lot of buzzwords there, but in aggregate it is nonsense. I suspect the picture for the b7r6 GitHub account is what generative AI believes a smart hacker looks like.
Is this the internet now?
https://imgur.com/a/KnbQBU7
I've got a lot of footage of all this stuff working, so let's hear some errata to the C++ style guide and not horseshit about bots
https://youtube.com/@b7r6-c3t?si=ukuKmx4EIp1IKMdb
Just about all the snippets are lightly adapted from shit I wrote before agents were relevant, so any fail in there is on me.
Do you have any errata or just a shitty attitude?
First off, i highly suggest that you expand this into a full-blown book. This could become a successor to a combination of {Adrian & Piotr's "Software Architecture with C++" + Fedor Pikus' "The Art of Writing Efficient Programs"} for the Agentic era.
I really like that you are using Lean4 for parts of code generation, tips for Agentic coding etc. which are all needed today. I myself have been thinking on these lines i.e. using formal methods for specification and verification so that agent-generated code can be "correct-by-construction" and efficient. Your write-up is the first i have seen which tries to provide the overall picture.
Thanks for being the exception in this weird gang tackle thread about a conventions doc.