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

RIP drm

13 October, 201113 October, 2011

This week, Dennis M. Ritchie, co-creator of C and Unix, died. His death has not made the front page like Steve Jobs’ did. But although the non-tech world had never heard of him, he was more important than Jobs. I can still remember buying my copy of K&R, that slim…

Read More

How to print anything in C++ (part 1)

1 February, 201530 June, 2015

Part 1 Part 2 Part 3 Part 4 Part 5 Postscript I thought I’d have a go at writing some code that could print things. A pretty-printer, if you like. What I want to be able to do is this: // Print x correctly, where x is ANY type. cout

Read More

VS2010 woes: tuples as map keys

20 February, 201530 June, 2015

Another day, another compiler/library bug. If you’re unfortunate enough to still be using Visual Studio 2010, don’t use tuples as map keys. #include #include #include using namespace std; typedef tuple FooT; typedef map MapT; int main(int, char*[]) { MapT m; // put a value in the map { FooT f(nullptr,…

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