←back to thread

420 points gnabgib | 1 comments | | HN request time: 0.218s | 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 #
1. godelski ◴[] No.44001019[source]
Related, Computerphile had a video a few months ago where they try to put compute time relative to human time, similar to the way one might visualize an atom by making the proton the size of a golfball. I think it can help put some costs into perspective and really show why branching maters as well as the great engineering done to hide some of the slowdowns. But definitely some things are being marked simply by the sheer speed of the clock (like how the small size of a proton hides how empty an atom is)

  https://youtube.com/watch?v=PpaQrzoDW2I