Page MenuHomePhabricator

eo: event callback call optimization

Authored by bu5hm4n on Aug 5 2020, 2:05 AM.



a little overfiew to how eos event emission is working:

  • In eo there are 2 types of events restart events and normal events. Normals are *always* emitted from callback_max to 0 Restarts are emitted from the previous emissions current idx to 0. The previous emission will stop then
  • To keep track of the previous event emissions for restarts there was an eina inlist.
  • To keep track of other things in eo, there was an additional eo event stack frame (newly inserted events etc. etc.)

This commit now uses this event stack frame for implementing the details
about the restart events. This has the advatage that every
efl_object_data contains one byte less, and the up to date keeping of
the id's in the restart infrastructure is not needed anymore, making the
whole event emission code less instructions and faster.

How this now works:

  • Every emission has a event emission frame, when the emission starts, the frame is added, next points to the next older event emission. In this event stack frame we are storing the current idx, the description and a few other things that are not really relevant at this point.
  • when a restart event is started, this event stack is searched from the current frame up to the next one featuring the same event description. The event frame stack is then remembered, if the event emission is done, the current idx (normally 0 or something higher when callback was stopped) is then copyied back to the earlier frame.
  • Based on the nature of the event frame stacks, the idx is updated every iteration. And for the restart events, we only need to know the next, which removes the need of permanently updating the idx in the current stack.
  • The event frame stack is not allocated on the heap, hence more things in there does not matter at all.

Depends on D12079

Diff Detail

rEFL core/efl
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
bu5hm4n created this revision.Aug 5 2020, 2:05 AM
bu5hm4n requested review of this revision.Aug 5 2020, 2:05 AM
cedric added inline comments.Aug 5 2020, 9:27 AM

It would be nice to keep some comments around to explain what is going on in this part of the code :-)

But yeah, i will write more comments for the code there.


mhm, the problem is that the code that had comments, is now gone :-D

bu5hm4n updated this revision to Diff 31004.Aug 5 2020, 9:56 AM
bu5hm4n edited the summary of this revision. (Show Details)

add comments and a nicer for loop

cedric accepted this revision.Aug 5 2020, 10:11 AM
This revision is now accepted and ready to land.Aug 5 2020, 10:11 AM
Closed by commit rEFL3d547a0b06c5: eo: event callback call optimization (authored by Marcel Hollerbach <>). · Explain WhyAug 6 2020, 1:35 AM
This revision was automatically updated to reflect the committed changes.