summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-10-12 16:21:19 +0100
committerTom Hacohen <tom@stosb.com>2015-11-09 11:43:04 +0000
commit44ca3a366975d07a1dcb425dd21ba1073edfa3eb (patch)
tree596dd490beca1c54dd27045f45a06e9b65a6b1ca
parent1ed0edfb9eff9796443078497bc7c088da32f378 (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.
-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 0f8b0659fd..7d9847fdea 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1606,9 +1606,20 @@ _eo_condtor_done(Eo *obj_id)
1606} 1606}
1607 1607
1608static inline void * 1608static inline void *
1609_eo_data_scope_safe_get(const _Eo_Object *obj, const _Eo_Class *klass)
1610{
1611 if (EINA_LIKELY(klass->desc->data_size > 0))
1612 {
1613 return _eo_data_scope_get(obj, klass);
1614 }
1615
1616 return NULL;
1617}
1618
1619static inline void *
1609_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass) 1620_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass)
1610{ 1621{
1611 if (EINA_LIKELY((klass->desc->data_size > 0) && (klass->desc->type != EO_CLASS_TYPE_MIXIN))) 1622 if (EINA_LIKELY(klass->desc->type != EO_CLASS_TYPE_MIXIN))
1612 return ((char *) obj) + klass->data_offset; 1623 return ((char *) obj) + klass->data_offset;
1613 1624
1614 if (EINA_UNLIKELY(klass->desc->data_size == 0)) 1625 if (EINA_UNLIKELY(klass->desc->data_size == 0))
@@ -1639,7 +1650,7 @@ _eo_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Eo_Cl
1639 void *data = NULL; 1650 void *data = NULL;
1640 if (klass != NULL) 1651 if (klass != NULL)
1641 { 1652 {
1642 data = _eo_data_scope_get(obj, klass); 1653 data = _eo_data_scope_safe_get(obj, klass);
1643 if (data == NULL) return NULL; 1654 if (data == NULL) return NULL;
1644 } 1655 }
1645 (obj->datarefcount)++; 1656 (obj->datarefcount)++;
@@ -1723,7 +1734,7 @@ eo_data_scope_get(const Eo *obj_id, const Eo_Class *klass_id)
1723 } 1734 }
1724#endif 1735#endif
1725 1736
1726 ret = _eo_data_scope_get(obj, klass); 1737 ret = _eo_data_scope_safe_get(obj, klass);
1727 1738
1728#ifdef EO_DEBUG 1739#ifdef EO_DEBUG
1729 if (!ret && (klass->desc->data_size == 0)) 1740 if (!ret && (klass->desc->data_size == 0))