evas: don't emit EVAS_CALLBACK_MOVE event if nobody is listening.

This give a constant improvement of 2% over a total benchmark run while scrolling
genlist. This benchmark included setup and destruction of the scene, so under
estimate the cost of the callback emit.
This commit is contained in:
Cedric BAIL 2016-02-01 15:46:50 -08:00
parent 1ec244a09e
commit bdd163fce8
3 changed files with 15 additions and 6 deletions

View File

@ -201,6 +201,11 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
if (!(e = obj->layer->evas)) return; if (!(e = obj->layer->evas)) return;
_evas_walk(e); _evas_walk(e);
if (type == EVAS_CALLBACK_MOVE &&
obj->move_ref == 0)
goto nothing_here;
{ {
switch (type) switch (type)
{ {
@ -248,6 +253,7 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
} }
} }
nothing_here:
if (!obj->no_propagate) if (!obj->no_propagate)
{ {
if ((obj->smart.parent) && (type != EVAS_CALLBACK_FREE) && if ((obj->smart.parent) && (type != EVAS_CALLBACK_FREE) &&

View File

@ -117,10 +117,10 @@ _check_event_catcher_add(void *data,
eo_event_callback_add(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _animator_repeater, obj)); eo_event_callback_add(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _animator_repeater, obj));
INF("Registering an animator tick on canvas %p for object %p.", INF("Registering an animator tick on canvas %p for object %p.",
obj->layer->evas->evas, obj->object); obj->layer->evas->evas, obj->object);
}
// No need to walk more than once per array as you can not del else if (array[i].desc == EVAS_OBJECT_EVENT_MOVE)
// a partial array {
break; obj->move_ref++;
} }
} }
@ -147,8 +147,10 @@ _check_event_catcher_del(void *data,
eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _animator_repeater, obj)); eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _animator_repeater, obj));
INF("Unregistering an animator tick on canvas %p for object %p.", INF("Unregistering an animator tick on canvas %p for object %p.",
obj->layer->evas->evas, obj->object); obj->layer->evas->evas, obj->object);
}
break; else if (array[i].desc == EVAS_OBJECT_EVENT_MOVE)
{
obj->move_ref--;
} }
} }

View File

@ -1073,6 +1073,7 @@ struct _Evas_Object_Protected_Data
unsigned int ref; unsigned int ref;
unsigned int animator_ref; unsigned int animator_ref;
unsigned int move_ref;
unsigned char delete_me; unsigned char delete_me;