Re: Efficient object wrappers and GC
Re: Efficient object wrappers and GC
- Subject: Re: Efficient object wrappers and GC
- From: "David Wilson" <email@hidden>
- Date: Fri, 11 Apr 2008 23:21:14 -0400
On Fri, Apr 11, 2008 at 4:15 PM, Michael Ash <email@hidden> wrote:
> I think it's inherently not possible to do without destroying the
> speed you're trying to gain. Due to how Apple's collector is
> implemented, not generating write barriers for stack values, seeing if
> an object has been stored requires re-scanning all dirty parts of the
> stack.
If you're not opposed to trading memory for the speed, you can link
the wrapper to the underlying structure to ensure that you create one
and only one wrapper for each underlying data node. The enumerator can
then return the unique wrapper for the appropriate next node. You'll
have to make sure that the GC doesn't think the wrappers are trashable
(toss them all in some storage structure?).
This way you'll pay the speed penalty the first time through, but on
subsequent passes you'll only pay the penalty for nodes that haven't
been seen yet. The actual benefit you get from this depends heavily on
how often you modify the underlying structure, which would require you
to toss out old wrappers for deleted nodes and create new ones for the
not-yet-visited nodes.
--
- David T. Wilson
Princeton Satellite Systems
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden