I fought the compiler, and the compiler lost
Posted on March 23rd, 2008
Our Easter baskets were fairly small this year, what with me and mom being on a diet. The entire list of loot is a chocolate bunny, chocolate covered rice crispy treats and a bag of Reese's Pieces eggs. I pretty much single-handedly inhaled the latter, leaving only 2.5 servings out of 9. Obviously I'm not counting the candy on my diet -- as far as anyone knows, Easter candy has zero calories on Easter.

Speaking of candy, the neighbors below must've had a fair amount as their kids bounced off the walls, floor and ceiling to the frustration of their parents all morning. Hyperactive little boys and sugar are a dangerous combo.

The main Easter celebration this year was lunch. Our oven didn't work over Thanksgiving, so we re-did Thanksgiving dinner today. There was turkey, pumpkin pie, cranberry sauce shaped like a can, potatoes and corn.

Since I had yet to start coding Project Noise again I decided to check and see if the much-vaunted classes I wrote the other day actually work. I wrote a program to compare them to the compiler-supplied classes they replace. This has them load 1,000 elements and retrieve all 1,000 elements and prints out how long it took for them to do this.

Initially the compiler's classes were far faster. At most it took 16 milliseconds for one of them to go through the paces. Mine took 1,377 milliseconds to do the same job. After much revising and a lot of tweaking, my classes are now within 1 millisecond of the compiler's classes.

The bigger boon is not as obvious. Using the compiler's classes adds 100 KB to 150 KB to your binary's file size. Using my classes adds only 6 KB. How's that for tight code? Considering that a bare-bones binary is 25 KB, the additional 150 KB is ridiculous.

The only link of interest for today is a news article that answers an age old question: What in the world do bunnies and eggs have to do with Easter?

Most recent posts
Previous Post
Next Post




LJ Feed


List of UGuardian's Websites