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.
This commit is contained in:
Tom Hacohen 2015-10-12 16:21:19 +01:00
parent 1ed0edfb9e
commit 44ca3a3669
1 changed files with 14 additions and 3 deletions

View File

@ -1605,10 +1605,21 @@ _eo_condtor_done(Eo *obj_id)
obj->condtor_done = EINA_TRUE;
}
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))
@ -1639,7 +1650,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)++;
@ -1723,7 +1734,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))