Commit 1bf38d08d77d9570389ef45a07ae410c8d21b9ad

Note some potential optimizations.
  
365365 # Find all relevant methods in the obsever, and explicitly observe
366366 # the corresponding events. Heavy at setup, but light while
367367 # running.
368 #
369 # TODO - We can probably optimize this. The methods shouldn't
370 # change often. Can we cache the methods and invalidate the cache
371 # at the proper times?
368372
369373 foreach my $callback (
370374 grep /^on_${role}_\S+$/,
390390sub emit {
391391 my ($self, @args) = @_;
392392
393 # TODO - Checking arguments is tedious, but _check_args() method
394 # calls add up.
395
393396 my $args = $self->_check_args(
394397 \@args,
395398 [ 'event' ],
403403 my $callback_args = $args->{args} || {};
404404
405405 # Look for self-handling of the event.
406 # TODO - can() calls are also candidates for caching.
406407
407408 if ($self->can("on_my_$event")) {
408409 my $method = "on_my_$event";
418418 );
419419
420420 # This event is observed. Broadcast it to observers.
421 # TODO - Accessor calls are expensive. Optimize them away.
421422
422423 while (
423424 my ($observer, $callbacks) = each %{$self->watchers_by_event()->{$event}}