Skip to content

Commit

Permalink
Removes the last yield from the event handling iteration.
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsracz committed Aug 31, 2015
1 parent 66ace0d commit f0de769
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
13 changes: 13 additions & 0 deletions event_handler_performance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,16 @@ processing events with zero match in the registry:
2-8 msec for 100 events.


AFTER SECOND ROUND OF OPTIMIZATION
=================================

processing events with 8 match in the registry: (0100)
8-17 msec

processing events with one match in the registry:
6-15 msec for 100 events.

processing events with zero match in the registry:
2-8 msec for 100 events.


18 changes: 9 additions & 9 deletions src/nmranet/EventService.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -313,17 +313,17 @@ void InlineEventIteratorFlow::no_more_matches()

StateFlowBase::Action InlineEventIteratorFlow::perform_call()
{
/// @TODO (balazs.racz) we should have a different Notifiable here. The
/// problem is that if the Notifiable is notified inline, we want to keep
/// performing the iteration inline without returning to the executor. This
/// is not possible with the existing implementation of
/// BarrierNotifiable. A possible solution would be to take another child
/// of the barrier, and test after the call for the barrier to have exactly
/// one outstanding child left (no that's not a race condition); if yes,
/// then call immediately else notify and wait-and-call.
n_.reset(this);
// It is required to hold on to a child to call abort_if_almost_done.
auto* c = n_.new_child();
(currentHandler_->*(fn_))(&eventReport_, &n_);
return wait_and_call(STATE(iterate_next));
if (n_.abort_if_almost_done()) {
// Aborted. Event handler did not do any asynchronous action.
return call_immediately(STATE(iterate_next));
} else {
c->notify();
return wait_and_call(STATE(iterate_next));
}
}

} /* namespace nmranet */

0 comments on commit f0de769

Please sign in to comment.