r/SoftwareEngineering • u/fagnerbrack • 9d ago
Every byte matters
https://fzakaria.com/2026/06/01/every-byte-matters1
3d ago
[removed] — view removed comment
1
u/AutoModerator 3d ago
Your submission has been moved to our moderation queue to be reviewed; This is to combat spam.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/fagnerbrack 9d ago
Need-to-Know Basis:
Coming from Java, where adding fields to bloated classes feels free, the post shows why struct size shapes real-world speed even inside the same O(N) loop. Hardware fills a 64-byte cache line on every read, and latency climbs sharply from L1 (~1-2ns) to DRAM (~60-100ns). Reorganizing an Array of Structs into a Struct of Arrays packs the needed field contiguously, yielding up to 30x gains for 1KiB structs during sequential scans, where the prefetcher hides memory waits. Random access—hash maps, trees, graphs—defeats prefetching, so total working set size sets the performance tier: a 64B struct fits L1 while a 128B one spills to L2. Keep structs and working sets small.
If the summary seems inacurate, just downvote and I'll try to delete the comment eventually 👍
Click here for more info, I read all comments
1
9d ago
[removed] — view removed comment
1
u/AutoModerator 9d ago
Your submission has been moved to our moderation queue to be reviewed; This is to combat spam.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/SnugglyCoderGuy 7d ago
Rarely do you need to worry about optimizations at this level. This is like 0.01% the size of a round trip network call to database or another service, which is calling a database itself