Tuesday, January 18, 2011

Optimization Wars: Problems with CS Education

You may or may not know that I am currently a Computer Science student at Michigan State University. While it may come as no surprise that much of my knowledge of Graphics and Game Dev are largely a consequence of my own initiatives because no large public University is going to tailor its CS program to game dev. Which is totally fine, I expect that.

However, I've become increasingly disturbed with a trend that I believe to be a common denominator across most CS programs that work in any sort of prep for an engineering-type coding position. The trend is a general disregard for optimization. This post (rant maybe?) is essentially inspired from a #AltDevBlogADay by Chris Kosanovich but is fueled from my personal experiences in the University environment.

Chris's post is about the mentality that many software engineers get into where they only want to think in high level terms and don't want to consider optimization. Here's the quote from a conversation that he posts that really does it for me:

"’optimizing’ is what compilers are for.”
Frankly I wasn’t sure if this was a joke so I replied
“compilers will never do as good a job at optimizing as people”
after which all I got for reply was “yeah right”.

This pretty much summarizes the problem that I've found with the University system: we're not really taught optimization in the main curriculum. At least, only by the best professors do serious discussions arise. But perhaps the most enlightening experience that I've had about the overall attitude was in a software engineering class where the "Gang of Four" book is a required text. Several lectures into the class I asked what performance implications a certain design pattern had, to which the professor replied:

"In a professional setting, readability and design are much more important, optimization is not relevant to this course."

What, seriously? For the "Software Engineering" course? I started bringing my laptop to class to work on my games project during that lecture time after we had that particular conversation. I still got a 4.0 for the class, but the class became one of the least relevant classes in a program I've become so proud of here at MSU. I now realize I should have expected the professors response but still... this class is touted and one of the highlights of our program and it's just really misleading in terms of what a code writer should be striving for- even if they aren't going into games.

Chris ends his post with a dream of a mythical college class about hand optimizing code. We can dream... But the honest answer that it's up to students to realize that their programs have been twisted by a field full of people who too often backslide into thinking that their goal is to make their own job "easier" with design patterns and the like, even if it makes their product worse. I've heard people claim over and over again that a portfolio and game programming experience are critical to landing a job in games. I wish they would also mention the importance of optimization... I'm pretty sure it's important to all disciplines ranging from rendering to tools, so why aren't we making a bigger deal about it?

Sometimes I get worried that some of the other coders in the Video Game Specialization with me wouldn't understand why I would bit shift instead of doing integer division by 2. It gives me shivers.