• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Speed Traps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Speed Traps


  • Subject: Re: Speed Traps
  • From: Marcel Weiher <email@hidden>
  • Date: Tue, 20 May 2003 02:48:47 +0200

On Monday, May 19, 2003, at 11:22 Uhr, Nat! wrote:


I remember I actually once reverted back from inline ref counting to the Apple way, when I wrote the MulleSybaseEOAdaptor. When I implemented inline ref-counting on certain classes, things went slower, when I was fetching a lot (really a lot!) of objects.

And none of these objects were stored anywhere, like in arrays, dictionaries? How did you keep track of them if there were such a lot of them? Interesting...

Of course, there may be a way to get this, if you implement collections with methods like "addObjectAndRelease:" or "setAndReleaseObject:forKey:". These could get away with keeping the reference count at 1 (with the retain for storing and the release in the method name cancelling each other and the reference count not being touched).

Then I figured it like this (It's been a while, but I think I stil got it about right)

If your objects stay at a retain count of 1, then the Apple code does not need to create an entry in the hash table (1 being the default for an object), this saves 32 bit.

Yes. It turns out that all of the Apple objects I looked at use less than a full word for the inline reference count, by sharing with some other variable that didn't mind losing a few bits...

The decrease in speed I saw, was probably due to the fact that (quite a few) more memory pages had to be allocated from the OS, for the inline reference count overhead (my objects were small).

The merit of the default implementation is still dubious IMO, nevertheless it would be interesting to figure out how many objects typically in their lifetime exceed a retain count of 1.

All that are (a) stored in instance variables or (b) stored in collections, even if only temporarily.

Marcel


--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Speed Traps
      • From: Nat! <email@hidden>
References: 
 >Re: Speed Traps (From: Nat! <email@hidden>)

  • Prev by Date: Re: How to stop Classic launching iTunes? (Cocoa & Applescript)
  • Next by Date: Re: Speed Traps
  • Previous by thread: Re: Speed Traps
  • Next by thread: Re: Speed Traps
  • Index(es):
    • Date
    • Thread