←back to thread

420 points gnabgib | 1 comments | | HN request time: 0.199s | source
Show context
qingcharles ◴[] No.43999955[source]
I love these incomprehensible magic number optimizations. Every time I see one I wonder how many optimizations like this we missed back in the old days when we were writing all our inner loops in assembly?

Does anyone have a collection of these things?

replies(4): >>43999992 #>>44000134 #>>44000173 #>>44000633 #
masfuerte ◴[] No.43999992[source]
We didn't miss them. In those days they weren't optimizations. Multiplications were really expensive.
replies(6): >>44000045 #>>44001019 #>>44001612 #>>44001634 #>>44001978 #>>44008837 #
kurthr ◴[] No.44000045[source]
and divides were worse. (1 cycle add, 10 cycle mult, 60 cycle div)
replies(3): >>44000122 #>>44000234 #>>44000838 #
1. ryao ◴[] No.44000838[source]
Division still is worse:

https://github.com/ridiculousfish/libdivide