1. 17
  1. 6

    I wonder if this is accurate.

    The obvious question is, does the curve fit the “doubles every 18 years” idea? Is there an exponential growth pattern? Or is it more linear? Erratic maybe? Or asymptotic? Getting together a whole host of GCC versions and comparing their -O3 benchmark performance would be interesting.

    But another question I have, is: This kind of assumes that -O0 is a good “baseline” for what a compiler can do entirely without optimizations. But the compiler does a whole lot of stuff which affects performance but isn’t affected by the -O flag. It doesn’t seem implausible to me that compilers today are amazing at things like register allocation and instruction selection, which happens regardless of optimization level. Comparing GCC 1 and GCC 12 at -O0 would be interesting.

    Also, the post concludes that because of this, compilers should focus on improving programmer productivity (error messages, language design, …) rather than optimization. But the fact that optimizers are as good as they are today is a programmer productivity boon in itself, since programmers don’t have to even think about code generation for the most part; they can just write in a high level language and expect the compiler to produce good output. For some extremely performance sensitive loops, you may have to know what sort of stuff your optimizer deals well with, but you don’t have to drop down to assembly anymore. Hell, these days you can even get the compiler to automatically vectorize your loops if you write them just right. If that’s not a programmer productivity improvement I don’t know what is.

    1. 5

      Esteban Kuber, who is notoriously working on rustc diagnostics (apparently he searches Twitter for bad diagnostics from rustc, fix them, and reply to tweets), opined:

      The primary function of a compiler is to take malformed code and emit diagnostics to help the programmer turn it into well-formed code. A compiler is an error reporting tool with a code generation side-gig.

      So yes. You should concentrate on your main job, not a side-gig.

      1. 4

        I wonder if you tried old versions of compilers if the curve would fit

        1. 2

          Compiler optimization is a productivity booster for performance-sensitive applications. I never think of auto-vectorizing basic for-loops, inlining function calls, or eliding pointer indirections. And these sort of things are 90% of what’s possible to optimize for a given algorithm.