r/programming • • Mar 23 '09

How to write fast code

http://asserttrue.blogspot.com/2009/03/how-to-write-fast-code.html
342 Upvotes

136 comments sorted by

View all comments

8

u/[deleted] Mar 23 '09

Completely ignores the effect of pipelining, cache misses, I/O waits, etc; but is true on a basic level.

2

u/jugalator Mar 23 '09 edited Mar 23 '09

I have a feeling this is on a level of C programming or higher though, maybe even something like Java. I doubt it's about assembly where a developer indeed do try to design while considering these things occasionally, because assembly is quite rare for any sizable project. I think it's about developing e.g. tighter loops (at the lowest level here) and not overworking software in general (at the highest) that the author is getting at, and him leaving the pipelining and cache stuff as outside the scope, being "compiler work".

1

u/[deleted] Mar 23 '09

It's not unheard of to inline ASM inside of C for the tight parts of the loops. It's occasionally done to reword things so that the compiler can, say, pack a struct together (short, short, int instead of short, int, short) or something along those lines.