Skip to content
Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Why programming is fun

elbeno, 8 July, 200629 July, 2007

This week I have been working with a colleague on optimising a piece of code. Last week, what we started out with (a first implementation) was taking over 80ms to run in my test case. We had confidence that the overall algorithm was the correct one for the job, so even without that (usually most fruitful) source of optimisation, and just by changing the code around, converting a recursion to a tail-recursion and then a loop, inlining some other functions and simplifying the resultant code, and implementing a simple caching scheme, we have achieved a one-hundredfold speedup. The same test case runs in about 0.8ms. And that’s just having altered the C++ – we haven’t even started on the highly platform-specific assembly-level optimisations that we could do.

There can’t be many jobs where you can say at the end of the week that you made something one hundred times better.

Programming

Post navigation

Previous post
Next post

Related Posts

“In-place” might be less in-place than you think

5 May, 2015

The intuitive view of algorithms that work in-place is that (it sounds obvious) they don’t use any extra space. Canonically in C/C++ we think of something like reversing an array, or that interview staple, removing spaces from an ASCII string, which we might write as: int remove_spaces(char *s) { char…

Read More

RotateAVI

11 September, 200629 July, 2007

Your new digital camera takes great videos, right? And you have a nice 2GB flash/SD/whatever card in there so you can take plenty. But there’s one problem: you have lots of movies in portrait format, where you were holding the camera on its side, because after all that is how…

Read More

Six languages worth knowing

6 December, 200718 July, 2008

“A language that doesn’t affect the way you think about programming, is not worth knowing” – Alan Perlis. I’ve thought about this, and developed a short list of languages worth knowing. Not-so-coincidentally, each language in my list embodies a distinct computational model. In no particular order: The ALGOL family. C…

Read More

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

©2026 Why is a raven like a writing desk? | WordPress Theme by SuperbThemes