Undergraduate Education in Programming LanguagesSome people wonder why it's important for all undergrad CS majors to take a languages/compilers course, especially now that computing is a more mature subject and new general-purpose languages are appearing more slowly. So why require a PL course? Because it is important for students to know what kinds of optimizations their compiler can do, and then not do them manually. Most compiler optimizations (inlining, unboxing, pivoting, strength reduction, etc) can be done manually, in the source code, by hand. Unfortunately they always reduce the readability of the code. It's seldom worth doing this unless you get at least a 2x improvement in performance, and even then it's probably not worth it. On the other hand, if the compiler can do an optimization for you, or if by changing your coding style slightly or adding a few annotations you can let it do the optimization for you, it's a win for even a 10% gain in performance. Add up ten or twenty such optimizations and you're talking about a major competitive advantage. Students need to know what kinds of optimizations it is reasonable to expect of the compiler, and how much help it's going to need from the programmer. The only way to get an intuition for this is to learn how a compiler actually works (and to have Rice's Theorem beaten into their skulls with an aluminum baseball bat – the failure to do that should embarrass the PL faculties of our universities).
|