summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-08-05 11:53:19 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-08-05 11:53:19 +0200
commit9852b2b71410fa16051397f247b0ecaeb5245695 (patch)
treef6a6906bfe8695b0e9ddb5b2eeb2cd49607ea999
parent5dbc62a98bd72a3a1f88f4acf5586b00c9151dc3 (diff)
downloadefl-devs/bu5hm4n/perf.tar.gz
Revert "eo: make callback_add faster"devs/bu5hm4n/perf
This reverts commit d34a0321cba607392ef07739322e963419bd5af5.
-rw-r--r--src/lib/eo/eo_base_class.c55
1 files changed, 19 insertions, 36 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index c9b8859a4e..e076402819 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -89,7 +89,6 @@ struct _Efl_Object_Data
Eina_Bool need_cleaning : 1;
Eina_Bool allow_parent_unref : 1; // Allows unref to zero even with a parent
- Eina_Bool single_priority : 1;
};
typedef enum
@@ -1477,9 +1476,19 @@ _eo_callback_search_sorted_near(const Efl_Object_Data *pd, const Eo_Callback_Des
return middle;
}
-static inline void
-_eo_callbacks_array_bump(Efl_Object_Data *pd)
+static void
+_eo_callbacks_sorted_insert(Efl_Object_Data *pd, Eo_Callback_Description *cb)
{
+ Eo_Callback_Description **itr;
+ unsigned int length, j;
+ Efl_Event_Callback_Frame *frame;
+
+ // Do a dichotomic searh
+ j = _eo_callback_search_sorted_near(pd, cb);
+ // Adjust for both case of length == 0 and when priority is equal.
+ while ((j < pd->callbacks_count) &&
+ (pd->callbacks[j]->priority >= cb->priority)) j++;
+
// Increase the callbacks storage by 16 entries at a time
if (_eo_nostep_alloc || (pd->callbacks_count & 0xF) == 0x0)
{
@@ -1493,38 +1502,14 @@ _eo_callbacks_array_bump(Efl_Object_Data *pd)
if (EINA_UNLIKELY(!tmp)) return;
pd->callbacks = tmp;
}
-}
-static void
-_eo_callbacks_sorted_insert(Efl_Object_Data *pd, Eo_Callback_Description *cb)
-{
- Eo_Callback_Description **itr;
- unsigned int length, j;
- Efl_Event_Callback_Frame *frame;
-
- if (pd->single_priority && cb->priority == 0)
- {
- _eo_callbacks_array_bump(pd);
- pd->callbacks[pd->callbacks_count] = cb;
- }
- else
- {
- pd->single_priority = EINA_FALSE;
- // Do a dichotomic searh
- j = _eo_callback_search_sorted_near(pd, cb);
- // Adjust for both case of length == 0 and when priority is equal.
- while ((j < pd->callbacks_count) &&
- (pd->callbacks[j]->priority >= cb->priority)) j++;
- _eo_callbacks_array_bump(pd);
- // FIXME: Potential improvement, merge single callback description of the same priority
- // into an array when possible
- itr = pd->callbacks + j;
- length = pd->callbacks_count - j;
- if (length > 0) memmove(itr + 1, itr,
- length * sizeof(Eo_Callback_Description *));
- *itr = cb;
-
- }
+ // FIXME: Potential improvement, merge single callback description of the same priority
+ // into an array when possible
+ itr = pd->callbacks + j;
+ length = pd->callbacks_count - j;
+ if (length > 0) memmove(itr + 1, itr,
+ length * sizeof(Eo_Callback_Description *));
+ *itr = cb;
pd->callbacks_count++;
@@ -2677,8 +2662,6 @@ _efl_object_constructor(Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
{
DBG("%p - %s.", obj, efl_class_name_get(obj));
- pd->single_priority = EINA_TRUE;
-
_eo_condtor_done(obj);
return obj;