

Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- This looks like something that every serious C++ programmer should be reading.by zombot
- C++ CPUs?by notorandit
- Virtual functions cost a lot less here than I expected.by Blackthorn
- If you read this, you should be able to get a job at Jane Street
- Screen refresh vertical rate in Hz. C++ negative right.by hxnrye
- I'm somewhat dubious about anything talking about low level performance programming at the instruction level that doesn't distinguish between latency and throughput, never mind mention the incredibly out-of-order nature of modern desktop/server class CPU cores.by owlbite
- what if a language would allow to elegantly pack Optional values?
so the physical layout has a bit vector with one bit for each optional. and a popcnt over that bitvector (masked up to the value we're interested in) will give the actual slot to look into?
would also make sense to reorder / bucket fields by (byte) size
if you want to do that in any low level language (rust, c++) you have to deviate from their standard syntax for optionals, and you have to manually keep track of slot order. but for domains with many optional/default values, this amy really reduce cache pressure, no?
In higher level languages you can fake the effect (with flyweight facades), so from python such a packed "dataclass"-like class can look neat and clean. however at the low level there is no abstraction that allows to create your own data layout.
at least I didn't find anything yet.
by froh - Article title should be "Efficient C++ Programming for Modern 64-bit CPUs...".by egl2020