forked from enlightenment/efl
eolian: cache function in implements where possible to get O(1) lookup
This commit is contained in:
parent
8d9bae1172
commit
0c0d639693
|
@ -253,6 +253,7 @@ _get_impl_func(Eolian_Class *cl, Eolian_Implement *impl,
|
||||||
impl->klass = cl;
|
impl->klass = cl;
|
||||||
*foo_id = (Eolian_Function*)eolian_class_function_get_by_name(cl, imstr,
|
*foo_id = (Eolian_Function*)eolian_class_function_get_by_name(cl, imstr,
|
||||||
ftype);
|
ftype);
|
||||||
|
impl->foo_id = *foo_id;
|
||||||
return !!*foo_id;
|
return !!*foo_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,6 +354,7 @@ _db_build_implement(Eolian_Class *cl, Eolian_Function *foo_id)
|
||||||
eina_stringshare_ref(impl->base.file);
|
eina_stringshare_ref(impl->base.file);
|
||||||
|
|
||||||
impl->klass = cl;
|
impl->klass = cl;
|
||||||
|
impl->foo_id = foo_id;
|
||||||
impl->full_name = eina_stringshare_printf("%s.%s", cl->full_name,
|
impl->full_name = eina_stringshare_printf("%s.%s", cl->full_name,
|
||||||
foo_id->name);
|
foo_id->name);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,22 @@ eolian_implement_function_get(const Eolian_Implement *impl,
|
||||||
Eolian_Function_Type *func_type)
|
Eolian_Function_Type *func_type)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(impl, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(impl, NULL);
|
||||||
|
|
||||||
|
if (impl->foo_id)
|
||||||
|
{
|
||||||
|
if (!func_type)
|
||||||
|
return impl->foo_id;
|
||||||
|
|
||||||
|
if (impl->is_prop_get)
|
||||||
|
*func_type = EOLIAN_PROP_GET;
|
||||||
|
else if (impl->is_prop_set)
|
||||||
|
*func_type = EOLIAN_PROP_SET;
|
||||||
|
else
|
||||||
|
*func_type = eolian_function_type_get(impl->foo_id);
|
||||||
|
|
||||||
|
return impl->foo_id;
|
||||||
|
}
|
||||||
|
|
||||||
const Eolian_Class *klass = eolian_implement_class_get(impl);
|
const Eolian_Class *klass = eolian_implement_class_get(impl);
|
||||||
if (!klass)
|
if (!klass)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -67,6 +83,9 @@ eolian_implement_function_get(const Eolian_Implement *impl,
|
||||||
else
|
else
|
||||||
*func_type = tp;
|
*func_type = tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((Eolian_Implement*)impl)->foo_id = fid;
|
||||||
|
|
||||||
return fid;
|
return fid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,6 +164,7 @@ struct _Eolian_Implement
|
||||||
{
|
{
|
||||||
Eolian_Object base;
|
Eolian_Object base;
|
||||||
const Eolian_Class *klass;
|
const Eolian_Class *klass;
|
||||||
|
const Eolian_Function *foo_id;
|
||||||
Eina_Stringshare *full_name;
|
Eina_Stringshare *full_name;
|
||||||
Eina_Bool is_virtual :1;
|
Eina_Bool is_virtual :1;
|
||||||
Eina_Bool is_prop_get :1;
|
Eina_Bool is_prop_get :1;
|
||||||
|
|
Loading…
Reference in New Issue