Login to participate
  
       
Register   Lost ID/password?
Louis Kessler’s Behold Blog » Blog Entry           prev Prev   Next next

Thursday, February 1, 2007 - Thu, 1 Feb 2007

I’ve started working to improve the data structures, and do some optimization as well. Optimization (making a program work faster and use less memory) is actually a specialty of mine. When I started building my Chess Program over 30 years ago, you had to make it work as fast as possible and squeeze as much processing as possible into every second of computer time.

So I became pretty good at it. You want to know three tricks in optimization?

  1. Use a profiler to find out what’s taking the most resources. Usually you’ll find 5% of your code takes 95% of the time. Work on that 5% and ignore the rest.
  2. For that 5%, first see if you can do the same thing in a simpler way.
  3. Finally, you might be left with two or three “expensive” lines of code that are executed hundreds of thousands of times. Those are the ones you try to squeeze your performance out of.

There you have it. Simple as 3.1415926535897932384626433…

Since my last version release a few days ago, my work just on the data structure for relationships (Parent, Child, Husband/Wife and Family links) has reduced Behold’s execution time by 15% and memory use by 6%. The same 1.5 MB test file with 5800 names that took a full minute to run (as I described in my Sept 19th blog entry) now takes only 26 seconds. I’m hoping I can still take a few more chunks out of that before the next release.

No Comments Yet

Leave a Comment

You must login to comment.

Login to participate
  
       
Register   Lost ID/password?