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

Worth it for an object to cache its own IMPs?



On Mar 1, 2004, at 4:43 PM, Nat! wrote:

> Shark is certainly nice but overly detailed at this point in time. Try 
> Sampler.app.

The problem I've encountered with sampler is that it collects all the 
right data, but doesn't solve the visualization problem. It's a real 
struggle to find the piece I'm looking for.


> Can you give a ballbark figure how many objects are involved (like 
> 100000, a million) or so ?
> How many objects are dynamically generated for each "operation" and if 
> these are many, why is this necessary ?

I ran everything through ObjectAlloc to try to get an idea. It's sort 
of a fuzzy line between what Cocoa is using to support the UI elements 
and basic functionality and what I'm using, but a single UI event (add 
an object) took around ~1200 CFDicts and ~900 CFArrays.

Without taking the time to run through a bunch of test cases, I would 
wildly guess a single simple operation couldn't involve more than 100 
small collections within the actual engine. The problem is that these 
operations are stacked and multiplied recursively, particuarly at 
startup.

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.


> Hmm.. searching should be fast. Why would this be slow ?

At this point, I guess would sheer quantity of objects being 
manipulated.


>> It might also be that the autoreleased objects I'm getting back from 
>> KVC could be piling up,
>
> Why are you getting autoreleased objects back from KVC ? This is 
> unusual.

The objects I get back from valueForKeyPath are retained/autoreleased, 
or some equivalent, yes? Not that KVC itself is doing it, but rather 
the objectAtIndex, objectForKey, etc. methods than they boil down to.

Bottom line: I don't have to release a string I received from KVC when 
it's dealing with a dictionary/array tree.


    - Scott

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