2007-12-29

Limbo...

DNS has gone awry; this blog is currently in limbo.

Towards Siem Reap

My mind played many tricks on me during that relatively short morning flight from Singapore to Siem Reap, Cambodia. My subconscious knew before my conscious I'd be in for an enlightening experience. It would be the most primal country I have visited and the only heart of darkness to be found there would be my own.

Posted by Picasa

Code Performance -- The Fastest Option

I previously posted a screenshot showing the magnitude of difference between execution times for various ways of computing some total value.

Here's the relevant source code for the fastest option, ListIntLinqFastLambda. Yes, the names are probably inaccurate.

Parallel.For(0, marx, j =>
{
long subTotal = 0;
li.ForEach(q => subTotal += q);
subTotals[j] = subTotal;
});
subTotals.ForEach(part => total += part);

2007-12-27

Remember This When Solving Problems

There were two wood choppers, and their boss had given each of them the exact same amount of wood to chop, which was quite a bit.

The first woodchopper chopped all day and night, didn’t stop for anything – had to get it done!

The second woodchopper worked a little differently. He would stop every hour or so. Then he would disappear for 15 minutes, then come back and chop again. Every hour he did this. Chop for awhile, disappear for 15 minutes, come back, and chop again.

The boss came around the next day and saw the first woodchopper with his big pile of wood that still needed chopping. He then went over to the 2nd woodchopper and saw all the wood, now neatly chopped, into nice neat little piles.

The boss and the first wood chopper stared at the work of the 2nd woodchopper. Neither of them could understand how he was able to accomplish so much, so fast, especially in light of all those little breaks he was taking, and demanded an explanation.

The second woodchopper said, “That’s easy. Every time I went away, it was to sharpen my ax.”

2007-12-26

Code Performance -- The Slowest Option

I previously posted a screenshot showing the magnitude of difference between execution times for various ways of computing some total value.

Here's the relevant source code for the slowest option, ListIntFor:


for (int i = 0; i < Max; i++)
{
for (int iter = 0; iter < li.Count; iter++)
{
total += li[iter];
}
}


If you simply change the li.Count to a local reference (int itemCount = li.Count;) outside the outer loop, you'll get a ~15% speedup.

2007-12-24

Code Performance -- Measure Everything


The included screenshot shows 11 different ways to compute the same value. The data structures and looping constructs vary between each one.

I'll post the source code to various tests at later times.

2007-12-23

Christmas 2006 in Negril, Jamaica


Lighthouse Inn 2, Negril, Jamaica, originally uploaded by millerb.

I took this photo last year while on holiday in Negril, Jamaica. It's from the Lighthouse Inn 2 on the bluffs. The German proprietor embraces her first culture's traditions with her second home.

Business Software Development in a Nutshell

I'm a regular at the Ars Technica OpenForum and the following exchange is too good not to quote here.

Maxer:
Why is age 38 too old to be programming and why would they have "moved onto something better"?

PeterB:
Because business programming is, for a number of reasons, little more than mindless drudgery.

The entire software development industry (such as it is) is extremely dysfunctional, and anyone who was any good just wouldn't put up with it.

The 6th Annual KAA Holiday Gift Exchange

Since December 2002, my friends and I have participated in a bizarre gift exchange ritual where crap is flung back and forth, and the few good items are frantically stolen from each other if they are still in play.

My haul this year,

  • 3 snack sized bags of Sour Patch Kids
  • a Northwest Airlines Visa WorldPerks pizza cutter and small notepad
  • a Münchner Kindl patch
  • an unopened copy of MechWarrior 2
  • a crappy deck of playing cards
  • a bag of good coffee I brought
  • a nice Sugoi SubZero snow cap (model 92926U)
Next year, we hope to make it so we each only bring one funny/crappy gift. We're trying to move up in the world like everyone else.

2007-12-21

How to Drink Coffee 0

Coffee tastes less bitter if the drinker is less bitter.

2007-12-20

Yummy Nom Nom

Winter Bliss = Kemp's Light Egg Nog + Mount Gay Extra Old Rum

2007-12-19

Great Wall of Survivor: China?

I think Survivor China filmed somewhere between Jingshanling and
Simatai. Here's a picture closer to Simatai.

Great Wall of China 3

2007-12-18

Parallel Computing

If you can make your desktop application use 80% or more of all cores on the system, then you've done a very good job tweaking your code.

Many supercomputers are lucky to get over 10% CPU usage since there are so many other I/O bottlenecks.