diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2016-08-26 12:03:08 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2016-08-26 12:14:14 -0700 |
commit | 93a706a947cd2d6ef80f8704f4e23737fea1258f (patch) | |
tree | eca777b1ed0ae8573133b549154aeeed35ff1468 | |
parent | 5e67a80753c4cc0a33dfaba008c098e07acfadfa (diff) |
eo: general speedup of all Eo related operation.
This change rely on the fact that we do fetch the same
object id over and over again. _efl_object_call_resolve got
15% faster, efl_data_scope_get 20%.
-rw-r--r-- | src/lib/eo/eo_base_class.c | 3 | ||||
-rw-r--r-- | src/lib/eo/eo_ptr_indirection.x | 20 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c index 732d063482..35c7a9c960 100644 --- a/src/lib/eo/eo_base_class.c +++ b/src/lib/eo/eo_base_class.c | |||
@@ -11,6 +11,9 @@ | |||
11 | 11 | ||
12 | static int event_freeze_count = 0; | 12 | static int event_freeze_count = 0; |
13 | 13 | ||
14 | _Eo_Object *cached_object = NULL; | ||
15 | Eo_Id cached_id = 0; | ||
16 | |||
14 | typedef struct _Eo_Callback_Description Eo_Callback_Description; | 17 | typedef struct _Eo_Callback_Description Eo_Callback_Description; |
15 | 18 | ||
16 | typedef struct | 19 | typedef struct |
diff --git a/src/lib/eo/eo_ptr_indirection.x b/src/lib/eo/eo_ptr_indirection.x index d89b1ec311..cae59a4469 100644 --- a/src/lib/eo/eo_ptr_indirection.x +++ b/src/lib/eo/eo_ptr_indirection.x | |||
@@ -269,6 +269,9 @@ extern Generation_Counter _eo_generation_counter; | |||
269 | /* Macro used for readability */ | 269 | /* Macro used for readability */ |
270 | #define TABLE_FROM_IDS _eo_ids_tables[mid_table_id][table_id] | 270 | #define TABLE_FROM_IDS _eo_ids_tables[mid_table_id][table_id] |
271 | 271 | ||
272 | extern _Eo_Object *cached_object; | ||
273 | extern Eo_Id cached_id; | ||
274 | |||
272 | static inline _Eo_Object * | 275 | static inline _Eo_Object * |
273 | _eo_obj_pointer_get(const Eo_Id obj_id) | 276 | _eo_obj_pointer_get(const Eo_Id obj_id) |
274 | { | 277 | { |
@@ -289,6 +292,10 @@ _eo_obj_pointer_get(const Eo_Id obj_id) | |||
289 | DBG("obj_id is not a valid object id."); | 292 | DBG("obj_id is not a valid object id."); |
290 | return NULL; | 293 | return NULL; |
291 | } | 294 | } |
295 | else if (obj_id == cached_id) | ||
296 | { | ||
297 | return cached_object; | ||
298 | } | ||
292 | 299 | ||
293 | EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation); | 300 | EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation); |
294 | 301 | ||
@@ -297,7 +304,13 @@ _eo_obj_pointer_get(const Eo_Id obj_id) | |||
297 | { | 304 | { |
298 | entry = &(TABLE_FROM_IDS->entries[entry_id]); | 305 | entry = &(TABLE_FROM_IDS->entries[entry_id]); |
299 | if (entry && entry->active && (entry->generation == generation)) | 306 | if (entry && entry->active && (entry->generation == generation)) |
300 | return entry->ptr; | 307 | { |
308 | // Cache the result of that lookup | ||
309 | cached_object = entry->ptr; | ||
310 | cached_id = obj_id; | ||
311 | |||
312 | return entry->ptr; | ||
313 | } | ||
301 | } | 314 | } |
302 | 315 | ||
303 | ERR("obj_id %p is not pointing to a valid object. Maybe it has already been freed.", | 316 | ERR("obj_id %p is not pointing to a valid object. Maybe it has already been freed.", |
@@ -477,6 +490,11 @@ _eo_id_release(const Eo_Id obj_id) | |||
477 | if (_current_table == table) | 490 | if (_current_table == table) |
478 | _current_table = NULL; | 491 | _current_table = NULL; |
479 | } | 492 | } |
493 | |||
494 | // In case an object is destroyed, wipe out the cache | ||
495 | cached_id = 0; | ||
496 | cached_object = NULL; | ||
497 | |||
480 | return; | 498 | return; |
481 | } | 499 | } |
482 | } | 500 | } |