3 ms·
To those who don't know about compiler optimisation, the replacement with a closed form is rather suprising I'd say, especially if someone with Matt Godbolt's e
by zipy124 10mo ago
To those who don't know about compiler optimisation, the replacement with a closed form is rather suprising I'd say, especially if someone with Matt Godbolt's experience of all people is saying it is surprising.
Also this series is targeted towards more of a beginner audience to compilers, thus its likely to be suprising to the audience, even if not to you.
- mattgrice 10mo agoGauss supposedly did it when he was 7. The hardest part for the compiler is figuring out that you have a loop that computes that sum and does nothing else important.
- saagarjha 10mo agoUnfortunately I don’t have a hiring pipeline filled with Gausses
- CorrectHorseBat 10mo agoIt's something we saw in highschool, I would expect anyone with a CS degree to recognize this optimization. I barely know anything about compiler optimization, so I have no clue whether a compiler applying this optimization is surprising or something trivial.
- saagarjha 10mo agoImplementing this in a compiler is nontrivial.
- CorrectHorseBat 10mo agoYes, that was clear to me from the article and the discussion. My point is that to someone who knows about Gauss' formula but doesn't know anything about compilers might not understand what the fuss is about.