• 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: Nat! <email@hidden>
  • Date: Mon, 19 May 2003 23:22:20 +0200

Am Montag, 19.05.03 um 12:13 Uhr schrieb Marcel Weiher:

On Monday, May 19, 2003, at 02:20 Uhr, Kevin Elliott wrote:


With all due respect, how is "the performance is nearly the same" very different than "the difference isn't all that noticeable"?

It is "very different" in that the difference is ONLY not all that noticeable if you use NSObject's brain-dead refcount implementation, which is in itself several times slower than an inline reference count (almost 10 times for an optimized inline refcount). The reason it is so slow is that every refcount operation requires a hash lookup and possibly allocation/deallocation of the slot for the extra-refcount inserted into the table. Nobody in their right mind uses that, certainly Apple doesn't. All Apple-provided classes use some sort of inline refcount.


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. 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. 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.

Ciao
Nat!
------------------------------------------------------
This is your life
and it's ending one minute at a time. -- Palahniuk
_______________________________________________
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: Marcel Weiher <email@hidden>
References: 
 >Re: Speed Traps (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Splitview resize a la ProjectBuilder
  • Next by Date: Re: RE: Events between Objective C objects
  • Previous by thread: Re: Speed Traps
  • Next by thread: Re: Speed Traps
  • Index(es):
    • Date
    • Thread