in reply to precalculating event dates vs.recalculating them.

I'd start with a simple implementation with no pre-calculation and test to see how inefficient it is. Get some ballpark numbers for the number of potential users and events-per-user, load up some test data, and give it a try. If it's fast enough, you're done. Don't look back.

If it's not, then yes, pre-calculate. But be sure to treat it as cache data - ready to be invalidated if anything about an event changes. Finding all the invalidation points may be challenging if you don't have good data-encapsulation. All the more reason to invest now in a clean database abstraction that will give you a good way to add caching like this. If you do your job right none of the client code should change when your events switch from calculated on the fly to pre-calculated.

-sam

  • Comment on Re: precalculating event dates vs.recalculating them.