OpenSSH and the dangers of unused code
OpenSSH and the dangers of unused code
Posted Jan 21, 2016 13:39 UTC (Thu) by andresfreund (subscriber, #69562)In reply to: OpenSSH and the dangers of unused code by NAR
Parent article: OpenSSH and the dangers of unused code
My general feeling about a lot of these complains is that they're a bit one-sided. One one hand many of the same people complaining about such optimizations also complain how nobody cares about optimizations anymore. On the other hand they complain if compiler authors doing part of that work, removing the need for much more failure-prone and more hardware specific (i.e. badly aging) hand optimizations.
Most of the compiler authors aren't sitting there like a bond villain, saying "oh, shiny, an undefined behaviour, let's screw the user. Har. Har. Har.". They write code to infer value ranges and such, and optimize the code accordingly. In the vast majority of the cases that's exactly what code authors want.
Posted Jan 21, 2016 13:57 UTC (Thu)
by mjthayer (guest, #39183)
[Link] (1 responses)
By the 90-10 rule, you can assume that 90 percent of the code does not need optimising at all, either by hand or by the compiler. I much appreciate the compiler optimising those places which do need it, though sometimes I wonder whether pointing out potential hand optimisations instead might not be better still in some (many?) cases. Not that it is likely to happen soon, so I think I can safely wonder.
Posted Jan 21, 2016 14:05 UTC (Thu)
by andresfreund (subscriber, #69562)
[Link]
And humans are notoriously bad at prediction whether code belongs in the 10 or 90 percent bucket. It also changes over time. Whether it's 5-30% that need to be optimized in my experience also hugely depends on the type of project - and tentatively many C projects have a higher percentage of code needing to be optimized than code in higher level languages. And part of the reason why it's often a small percentage needing optimization is because the default code generation is good enough - but that already includes an optimizing compiler.
> I wonder whether pointing out potential hand optimisations instead might not be better still in some (many?) cases
Hand optimizations suck big time. They make code harder to read, and they don't work across existing platforms, not to speak of future ones.
Posted Jan 21, 2016 22:40 UTC (Thu)
by sionescu (subscriber, #59410)
[Link]
I have trouble believing that.
OpenSSH and the dangers of unused code
OpenSSH and the dangers of unused code
OpenSSH and the dangers of unused code