TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The ‘premature optimization is evil’ myth (2010)

6 pointsby sea6earover 9 years ago

2 comments

nkurzover 9 years ago
<i>A colleague of mine used to call C a WYWIWYG language—&quot;what you write is what you get&quot;—wherein each line of code roughly mapped one-to-one, in a self-evident way, with a corresponding handful of assembly instructions. This is a stark contrast to C#, wherein a single line of code can allocate many objects and have an impact to the surrounding code by introducing numerous silent indirections. For this reason alone, understanding what things cost and paying attention to them is admittedly more difficult – and arguably more important – in C# than it was back in the good ole’ C days. ILDASM is your friend … as is the disassembler. Yes, good systems programmers regularly look at the assembly code generated by the .NET JIT. Don’t assume it generates the code you think it does. </i><p>I love it. Rehighlighting:<p><i>good systems programmers regularly look at the assembly code generated by the .NET JIT.</i><p>Let&#x27;s consider the percentages, and what it implies about the Joe&#x27;s assessment of programmers.<p>What percentage of systems programmers in any language look at the generated assembly?<p>Is the percentage for .NET programmers higher or lower than the average systems programmer?<p>What percentage of programmers who regularly look the generated assembly meet the unstated &quot;other requirements&quot; of being a &quot;good systems programmer&quot;?<p>I can&#x27;t believe it&#x27;s a very high percentage that make it through this filter, for .NET or other.<p>And yet I think he&#x27;s right: how can one possibly be a good programmer without understanding what the computer is actually executing? And how can you understand what the computer is executing without looking at the assembly?
akshat_hover 9 years ago
I have always felt that premature optimization is the root of all evil implied that you will profile the code post writing and fix the bottlenecks. Also as long as there is no impact on code clarity, I don&#x27;t think writing (prematurely)optimum code is bad.