summaryrefslogtreecommitdiff
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
parente837a5e4ffa0b9a3fd4a8fd16452374dbd310476 (diff)
downloadefl-4ed0fe58579053a8f2728e1bcc5eba5dfd7cd47a.tar.gz
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 f8ea428356..3c7428f70c 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1559,9 +1559,20 @@ _eo_condtor_done(Eo *obj_id)
}
static inline void *
+_eo_data_scope_safe_get(const _Eo_Object *obj, const _Eo_Class *klass)
+{
+ if (EINA_LIKELY(klass->desc->data_size > 0))
+ {
+ return _eo_data_scope_get(obj, klass);
+ }
+
+ return NULL;
+}
+
+static inline void *
_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass)
{
- if (EINA_LIKELY((klass->desc->data_size > 0) && (klass->desc->type != EO_CLASS_TYPE_MIXIN)))
+ if (EINA_LIKELY(klass->desc->type != EO_CLASS_TYPE_MIXIN))
return ((char *) obj) + klass->data_offset;
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
void *data = NULL;
if (klass != NULL)
{
- data = _eo_data_scope_get(obj, klass);
+ data = _eo_data_scope_safe_get(obj, klass);
if (data == NULL) return NULL;
}
(obj->datarefcount)++;
@@ -1676,7 +1687,7 @@ eo_data_scope_get(const Eo *obj_id, const Eo_Class *klass_id)
}
#endif
- ret = _eo_data_scope_get(obj, klass);
+ ret = _eo_data_scope_safe_get(obj, klass);
#ifdef EO_DEBUG
if (!ret && (klass->desc->data_size == 0))