2010-06-17

Cyberiffic

An interesting debate regarding whether The Cyberwar has been greatly exaggerated, featuring Bruce Schneier and Admiral Mike McConnell. Intelligence Squared's poll gives the debate to McConnell and Zittrain, but it's likely tainted by ye olde selection bias.

2010-06-10

Smallthought to Twitter

Smallthought Systems has been acquired by Twitter. I met Avi Bryant very briefly (doubt he remembers little old me) at OSCON in 2006, and he struck me as one of the smartest developers I'd ever met. Good for him, and good for Twitter.

Because I can't resist

How to write like Malcolm Gladwell

2010-06-04

Don't forget "inline" and "register"

The conventional wisdom these days is that compilers are, like the Great and Powerful Oz, all-knowing, all-powerful, and all-optimizing. Instead of foolishly trying to make your code faster, you, mere mortal developer, should simply choose good algorithms, use standard libraries, and specify "-O3" to gcc.


The other day, on a lark, I decided to declare one of my functions "inline", since it was used in an inner loop of my main routine, and I also prefixed some of its local variables with the "register" keyword (I made these edits separately, so I could see whether either made a difference). My thought was, well, the compiler's probably chopping this code up six ways past Sunday, but, what the hell?, can't hurt to try. In return for the 5 minutes of time I spent doing this (including compiling and testing), I received a 20% performance improvement.

I'd already been specifying "-O3". I'd removed all the heap allocations. The code was fast enough that Shark couldn't find any obvious hot-spots. 20%.

So, after you write well-factored code, and choose good algorithms, and use profiling to find the hot-spots, and wonder where the next improvement will come from... remember your friends, "inline" and "register" and take 5 minutes to see whether they improve things for you.