summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-10-12 16:21:19 +0100
committerTom Hacohen <tom@stosb.com>2015-10-19 10:20:53 +0100
commit4ed0fe58579053a8f2728e1bcc5eba5dfd7cd47a (patch)
treeaca78b06622843a7fec96feca4f77626dd2c6251 /src
parente837a5e4ffa0b9a3fd4a8fd16452374dbd310476 (diff)
Eo: Optimise object data fetching a bit more.
Removed safety check that is not necessary. This may seem small, but this in addition to the previous commit, account for around 2% of CPU usage.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eo/eo.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index f8ea428..3c7428f 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1559,9 +1559,20 @@ _eo_condtor_done(Eo *obj_id)
1559} 1559}
1560 1560
1561static inline void * 1561static inline void *
1562_eo_data_scope_safe_get(const _Eo_Object *obj, const _Eo_Class *klass)
1563{
1564 if (EINA_LIKELY(klass->desc->data_size > 0))
1565 {
1566 return _eo_data_scope_get(obj, klass);
1567 }
1568
1569 return NULL;
1570}
1571
1572static inline void *
1562_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass) 1573_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass)
1563{ 1574{
1564 if (EINA_LIKELY((klass->desc->data_size > 0) && (klass->desc->type != EO_CLASS_TYPE_MIXIN))) 1575 if (EINA_LIKELY(klass->desc->type != EO_CLASS_TYPE_MIXIN))
1565 return ((char *) obj) + klass->data_offset; 1576 return ((char *) obj) + klass->data_offset;
1566 1577
1567 if (EINA_UNLIKELY(klass->desc->data_size == 0)) 1578 if (EINA_UNLIKELY(klass->desc->data_size == 0))
@@ -1592,7 +1603,7 @@ _eo_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Eo_Cl
1592 void *data = NULL; 1603 void *data = NULL;
1593 if (klass != NULL) 1604 if (klass != NULL)
1594 { 1605 {
1595 data = _eo_data_scope_get(obj, klass); 1606 data = _eo_data_scope_safe_get(obj, klass);
1596 if (data == NULL) return NULL; 1607 if (data == NULL) return NULL;
1597 } 1608 }
1598 (obj->datarefcount)++; 1609 (obj->datarefcount)++;
@@ -1676,7 +1687,7 @@ eo_data_scope_get(const Eo *obj_id, const Eo_Class *klass_id)
1676 } 1687 }
1677#endif 1688#endif
1678 1689
1679 ret = _eo_data_scope_get(obj, klass); 1690 ret = _eo_data_scope_safe_get(obj, klass);
1680 1691
1681#ifdef EO_DEBUG 1692#ifdef EO_DEBUG
1682 if (!ret && (klass->desc->data_size == 0)) 1693 if (!ret && (klass->desc->data_size == 0))