• 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: Problems with Key Observing Registration Performance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with Key Observing Registration Performance


  • Subject: Re: Problems with Key Observing Registration Performance
  • From: Markus Spoettl <email@hidden>
  • Date: Tue, 9 Sep 2008 18:48:05 -0700

On Sep 9, 2008, at 5:28 PM, Markus Spoettl wrote:
These numbers come from a test case with 140 objects, when I double the object number, the test never finishes (at least not within 10 minutes).


OK, I did some more testing and timing and there is a solution - which I don't understand:

Testing with 326 objects, adding each of the objects to the array like this

   NSMutableArray *kvoArray = [self mutableArrayValueForKey:@"array"];
   for (MyObject *obj in inputData) {
       [kvoArray addObject:newObject];
   }

This takes 580 seconds. Each add causes a chain reaction of events that eventually adds a new NSView to the collection view. I've experimented with setting the whole array at once using -setArray: but that does not make any difference.

However, adding an auto-release pool does make a huge difference:

   NSMutableArray *kvoArray = [self mutableArrayValueForKey:@"array"];
   for (MyObject *obj in inputData) {
       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

       [kvoArray addObject:newObject];

       [pool release];
   }

The same operation now takes 60 seconds. That's 10% of the original time.

What I don't understand is why adding the auto-release pool has such a dramatic impact on registering observers on the objects. Anyone know why?

Regards
Markus
--
__________________________________________
Markus Spoettl

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Follow-Ups:
    • Re: Problems with Key Observing Registration Performance
      • From: Negm-Awad Amin <email@hidden>
    • Re: Problems with Key Observing Registration Performance
      • From: Ken Thomases <email@hidden>
    • Re: Problems with Key Observing Registration Performance
      • From: Seth Willits <email@hidden>
References: 
 >Problems with Key Observing Registration Performance (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: NSRunLoop run semantics
  • Next by Date: Fade In and Fade Out Transitions Missing in IB
  • Previous by thread: Problems with Key Observing Registration Performance
  • Next by thread: Re: Problems with Key Observing Registration Performance
  • Index(es):
    • Date
    • Thread