Top
Best
New

Posted by ingve 7 hours ago

Every Byte Matters(fzakaria.com)
187 points | 86 commentspage 2
Luff 4 hours ago|
Yes we should end the hateful rhetoric of most and least significant bytes. Every Byte Matters.
diabllicseagull 4 hours ago||
We'll get there, bit by bit.
zabzonk 4 hours ago|||
We need an ending to byte-sizeism as well.
moi2388 4 hours ago||
In combination with “What colour are your bits” I do not see this ending well..
SuperV1234 3 hours ago||
Data Oriented Design rocks. It was the subject for my CppCon 2025 keynote: https://youtube.com/watch?v=SzjJfKHygaQ
setheron 2 hours ago|
Add it to my watch list!
nasretdinov 4 hours ago||
Ideally you'd want to go further and actually store the is_alive as a bit mask and use SIMD instructions to filter out zeroes for example.
coldcity_again 6 hours ago||
I love to see stuff like this. And an active Vectrex gamedev and PC/Amiga sizecoder I strongly agree with the sentiment!
AxelWickman 5 hours ago||
Cool read. The AoS vs SoA speaks for itself.
readthenotes1 2 hours ago||
"In that time, you get used to huge classes. New functionality? Just add a new method and field to the class"

I guess this is one reason why object-orientation has such a bad reputation.

I once worked at a bank where the OO mentor had taught people that the only object they needed was "Tape" and have them replicate the structure of data on the old spooled tape reels.

The struct of arrays reminds me of this optimization.

yas_hmaheshwari 6 hours ago||
Out of course: I had thought about reading an article about Iran war or some geo political news when I read fzakaria :-)
RickJWagner 6 hours ago||
That’s a great read. I wish more people wrote like that.
fdegmecic 5 hours ago|
CppCon 2014: Mike Acton "Data-Oriented Design and C++"

Andrew Kelley: A Practical Guide to Applying Data Oriented Design (DoD)

you should check these two talks out then.

lionkor 4 hours ago||
The first is quite famous in data oriented design/programming circles, the second one is up there, too. Both very much worth watching.
coolThingsFirst 6 hours ago|
Why doesn’t the machine fill up the other cache lines as well why is 64 bytes only and then a miss?
masklinn 5 hours ago||
They will absolutely do that (prefetching, they can even eagerly load what’s on the other side of a pointer).

However it requires additional hardware to recognize patterns which benefit from prefetching, and every time the CPU prefetches data which ends up not being used it has both burned energy and memory bandwidth, and evicted data from the cache which might be needed (cache pollution).

spiffyk 4 hours ago|||
A cache line is simply the unit of data a CPU cache works with (generally 64 bytes, because someone somewhere has probably determined that that is the best line size for general use), much like there are units of data like bytes (8 bits nowadays, but there have been weird ones historically), pages (varies between hardware as well, and may be OS-configurable), etc.

As TFA mentions, a CPU does some predictions about what cache lines to prefetch, e.g. when you do sequential reads. Moreover, the x86_64 instruction set provides a prefetch instruction through which you are able to give the CPU a hint "hey, I'm gonna be using this soon, prepare accordingly, pretty please".

Still, the utility of prefetching is diminished if you only use a single byte from each cache line, because the mechanism generally depends on you doing other work while the next cache line is being fetched. So really the best case scenario is to take as much time as possible to work with what is already fetched, so that there is time for the next unit of data to be fetched in the meantime.

Liquid_Fire 5 hours ago||
It might sometimes prefetch the surrounding lines as well, but ultimately cache space is limited, so there is a trade-off. Every time you fill a line, you are throwing away something else that was cached there previously, which you may need again in the near future.
More comments...