If you’re fortunate enough to be using a dual-screen setup (I suggest that everyone should be using dual screens), check out these 45 wallpapers from the constantly amazing Six Revisions.
Archive for October, 2009
Dual Screen Wallpaper
Sunday, October 11th, 2009Speeding up Report Calculations
Saturday, October 10th, 2009When creating reports that are calculation-heavy, it’s tempting to create functions like ‘calculatePercent()’ or ‘calculatedMedian()’ so the correct numbers are available on demand.
Sounds good and convenient, but what happens when you have 100 different calculations to make across 50,000 data records? Each report will take 5 million passes to generate. That could take a long time especially if there are multiple reports being generated.
DRY – Don’t Repeat Yourself
Fortunately, the solution is straightforward. Rather than passing through those 50,000 records 100 times (once for each percentage needed), create an array for your values and calculate ALL of them in one shot. Then, just have calculatePercent() and calculateMedian() call from that array. Sounds simple, and it is as the pseudocode below shows:
for each record:
for each value:
valueList[value].append( record[value] )