[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Conclusion -- Worth it for an object to cache its own IMPs?



On Mar 1, 2004, at 5:28 PM, Scott Stevenson wrote:

> Starting up using a somewhat complicated data set (but tame compared 
> to what it will need to do) burns well over 100k collection objects, 
> but nowhere near 1 million.
>
> The mechanics are potentially quite complicated, and the idea has been 
> to burn some resources (less lines of code, more objects, more 
> recursion) to keep the implementation conceptually simple. I may have 
> to draw the line in certain areas, though.

For what it's worth, just wanted to share that I was able to resolve 
this issue without dropping down to raw C (although I may do that at 
some point) and without doing any further implemenation caching.

Long story short, I figured out a way to create and populate (and 
destroy) far less foundation objects during a complex operation without 
changing the basic logic (numbers include those created by Cocoa):


Before:

CFArrays: 11,395
CFDictionaries: 143,613
CFStrings: 182,922


After:

CFArrays: 6,126
CFDictionaries: 5,807
CFStrings: 8,2457


This dropped the time required for the exact same complex operation 
from 3.4 seconds down to just 0.8 seconds. The basic data model stayed 
the same, just did some smarter caching in key places.


Thanks,

     - Scott

--
Tree House Ideas
http://treehouseideas.com/