Hi henrik
thanks for your analysis. I always wanted to deeply understand the
difference between announcements and a simple registry mechanism.
Now I'm too tired to think (yes I need to sleep a 9h25 :) but I will
reread this mail when my brain is back .
stef
Le 29/8/16 à 00:54, Henrik Nergaard a écrit :
Probably from the use of critical (mutex), the way #subscriptionsHandling: is
done, and that Announcer is built for X number of announcers and Y number of
subscribers, which means that each announcement the announcer has to filter and
find the correct subscribers.
----
| ann a |
ann := Announcer new.
ann when: Announcement do: [ :e ].
a := Announcement new.
[[ ann announce: a ] bench ] timeProfile
-----
Other drawbacks to consider when using announcements:
Memory overhead from the Announcer object and each subscription.
Memory ownership, the announcement subscriptions will strongly reference the
announcement target unless the announcement is weakly, which can lead to memory
leakage especially if strong and weak subscriptions are mixed in certain
situations (see the mailing list from around the release of Pharo 6). This also
leads to code where the announcer is the one who owns the target (multiple
times if there are different announcements), which makes understanding who
references what etc.. much harder to understand.
In many places the control/message flow, and the relationship between the
different parts of a bigger object tends to become much more difficult to
understand (For example Rubric).
Announcer usage shines when there is a need for a common place that X objects
can communicate Y messages to Z recipients without needing to know who sends
what, or who wants to receive what (For example System Announcements).
Communication when only one Object "A" announces to another Object(s) "B", is
better implemented as A referencing B, then B implements the necessary methods needed for this
communication.
Best regards,
Henrik
-----Original Message-----
From: Pharo-dev [mailto:[email protected]] On Behalf Of Glenn
Cavarlé
Sent: Sunday, August 28, 2016 9:11 PM
To: [email protected]
Subject: [Pharo-dev] About the non-use of Announcer in Bloc
Hi all,
Doru, Stephan, Norbert, Denis and me spoke at ESUG about the non-use of
Announcer in Bloc.
I made some test cases in Bloc-Tests to compare performances between Announcer
and BlEventRegistry.
The result is that Announcer is at least 5x slower in all tested cases.
Bloc has only specific needs about event dispatching, the first one is the
efficiency during event propagation.
It may be interesting to investigate why Announcer is slower and also what are
the uncovered cases in BlEventRegistry.
So, i'm interested in continuing our discussion about that.
Regards,
Glenn.
-----
Glenn Cavarlé
--
View this message in context:
http://forum.world.st/About-the-non-use-of-Announcer-in-Bloc-tp4913008.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.