November 13th, 2007

Faster, Turn Faster...

I've been bashing on the problem of speeding up our calculations here at work. The obvious solution is to perform some type of minimal recalc, so that you don't calculate numbers whose predecessors haven't changed.

But to implement that, you need a dirty flag. And while I had a place to store it for our lineitem variable types, I had no place to store it for the scalar variable types. And while I could have hacked something in, it made more sense to actually rationalize some of the infrastructure around our storage of scalar values so that I can add some new features there later rather than to keep piling things on so that the later conversion would be even more difficult.

That bunch of coding took a couple of weeks. I finished it up on Friday.

Today, I got minimal recalc working. I needed to change the way that we initialize our calculation order so that it was optimized for minimal recalc, but once that was done, the calculations were much faster, as I'd expected that they'd be.

This only helps when you're calculating the same scenario over and over again, but that's a pretty common use case. And it'll do for now. :)