The Golden Rule of Compiler-Writers
Performance is almost everything in a compiler. There are other concerns: meaningful error
messages, good documentation, and product support. These factors pale in comparison with
the importance users place on raw speed. Compiler performance has two aspects: runtime
performance (how fast the code runs) and compile time performance (how long it takes to
generate code). Runtime performance usually dominates, except in development and student
environments.
Many compiler optimizations cause longer compilation times but make run times much
shorter. Other optimizations (such as dead code elimination, or omitting runtime checks)
speed up both compile time and run time, as well as reducing memory use. The downside of
aggressive optimization is the risk that invalid results may not be flagged. Optimizers are
very careful only to do safe transformations, but programmers can trigger bad results by
writing invalid code (e.g., referencing outside an array's bounds because they "know" that
the desired variable is adjacent).
This is why performance is almost but not quite everything—if you don't get accurate
results, then it's immaterial how fast you get them. Compiler-writers usually provide
compiler options so each programmer can choose the desired optimizations.

浙公网安备 33010602011771号