Notification redundancy
Notification redundancy
- Subject: Notification redundancy
- From: Erez Anzel <email@hidden>
- Date: Wed, 28 Jan 2004 10:09:22 -0500
I have enjoyed using the notification system built into Cocoa. But the
standard approach may not be the wisest in my situation, where I may
have tens of thousands of objects sending notifications, and multiple
observers.
If the user changes 50,000 objects in one action, and I use the
"standard" Cocoa approach, then 50,000 notifications are sent to my
registered observer(s), each with its own dictionary attached. (Each
notification comes from the object's primitive "set" method.) Three
views onto the same data means that each notification is observed and
acted upon three times, for a total of 150,000 observations and
reactions. Probably pumps up RAM usage as well, since I can't create
and release my own pool for these notifications; they have to persist
past the time that my action method completes its task.
In a case like this, it's more efficient for the action method to post
the notification, instead of each object. I could make a decision at
runtime as to whether the action posts the notification, or each
object, depending upon how many objects are involved. But this starts
to get messy; I have many different actions, many object types, and
many "set" methods for each.
Any wisdom on this issue?
TIA...Erez
_______________________________________________
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.