r/programming • u/f311a • Aug 09 '26
Assembly Hall of Shame: Racing to the bottom of CPU performance
https://github.com/xoreaxeaxeax/asm-hall-of-shame
560
Upvotes
r/programming • u/f311a • Aug 09 '26
14
u/tbsdy Aug 09 '26
Explanations?
302
u/HighRelevancy Aug 09 '26
I would never have guessed that 62 seconds for a single instruction was possible without outright cheating like disabling the core it's scheduled on. Incredible stuff.
93
u/mccoyn Aug 09 '26
The PDP-10 has indirect addresses that were automatically dereferenced. This was repeated if the resulting address was an indirect address. So, you could fill memory with a linked list of indirect addresses and any instruction could walk all of memory before completing.
77
u/mcmcc Aug 09 '26
This one is diabolical: https://github.com/xoreaxeaxeax/asm-hall-of-shame/tree/main/split_lock
Not only is it horrendously slow on its own but it locks up the memory bus for all other cores while it's executing.
Moral of the story: unaligned memory accesses are not "almost free" as some would have you believe.
23
u/dontquestionmyaction Aug 09 '26
Eh. There is interesting stuff in the lower rankings there, but at a certain point it's just finding slow IO, which kinda misses the point imo
3
u/ReDucTor Aug 09 '26
The MMIO ones are interesting, but it felt a bit like how many different things can I use to load from these addresses.
1
u/BetterAd7552 Aug 10 '26
I have not touched assembly since 8086, can someone elaborate on how mov can consume ~440m cycles?
Or is that some kind of mov* variant which does something besides moving bytes/words between registers?
-15
u/HankOfClanMardukas Aug 09 '26
My daily stand up with Microsoft was me saying, “it’s not done yet” snd walking away. I was trying to get fired because I had another job lined up and they still didn’t care.
0
u/[deleted] Aug 09 '26
[deleted] — view deleted comment