Is premature optimization really the root of all evil?

Posted by Craig Day on Programmers See other posts from Programmers or by Craig Day
Published on 2008-10-17T08:34:39Z Indexed on 2013/10/27 4:15 UTC
Read the original article Hit count: 262

Filed under:
|
|

A colleague of mine today committed a class called ThreadLocalFormat, which basically moved instances of Java Format classes into a thread local, since they are not thread safe and "relatively expensive" to create. I wrote a quick test and calculated that I could create 200,000 instances a second, asked him was he creating that many, to which he answered "nowhere near that many". He's a great programmer and everyone on the team is highly skilled so we have no problem understanding the resulting code, but it was clearly a case of optimizing where there is no real need. He backed the code out at my request. What do you think? Is this a case of "premature optimization" and how bad is it really?

© Programmers or respective owner

Related posts about design

Related posts about optimization