Monday night, I'd had a brilliant (if I do say so myself) idea on how to solve a problem that's been vexing us for quite some time.
Tuesday and Wednesday, we talked about my ideas and came up with some alternatives. We liked my idea, but we were worried about the time required to build a certain data structure.
So today, Mike and I experimented to see whether my idea was viable:
We slammed out an implementation of the data structure. (Using an STL multimap was extremely handy; we were able to write the whole structure in less than two pages of code. But we worried that it might not be optimally efficient.)
In thinking about what we needed to do to build this structure, I realized that we had another algorithm class lying around that could be adapted to serve our needs, despite the fact that this task was fairly foreign to its original purpose. We managed to make it serve our purpose by overriding only one virtual method. (We cut a few corners here, and we didn't bother to use one complex optimization that might have given us better paging behavior.)
By then, it was 6:00, and we'd reached a good stopping place. But Mike pointed out that to do the timings we needed, we didn't have to write any code to integrate our new data structure; we could just write a simple driver program. So we slammed that out. We even managed to write the driver program with only one syntax error.
And then we timed it: with a cold cache, it adds 0.4 seconds to the time to load a very small database, 1.0 seconds to the time to load a medium-small database, and 70 seconds to the time to load a large database--and that's with debug code. This is very viable.
I just *love* days like this, when we can pull off amazing stuff because my mastery of the toolkit is so total that it will turn somersaults for me. I love being this good.
(Let me not be too vain: I would not have finished this so quickly were it not for Mike's knowledge of the STL and his great bug-spotting. We work together far better than I would work alone.)