On 14/07/14 20:29, Cedric BAIL wrote: > On Mon, Jul 14, 2014 at 7:54 PM, Tom Hacohen <[email protected]> wrote: >> On 06/07/14 12:27, Cedric BAIL wrote: >>> cedric pushed a commit to branch master. >>> >>> http://git.enlightenment.org/core/efl.git/commit/?id=3dcc172f5706f73c0c2d9311f246f5b43831c49b >>> >>> commit 3dcc172f5706f73c0c2d9311f246f5b43831c49b >>> Author: Cedric BAIL <[email protected]> >>> Date: Sun Jul 6 13:15:21 2014 +0200 >>> >>> eo: make parent_set a O(1) operation instead of O(n). >>> >>> This does impact performance quite significantly when you have a lot >>> of children. >>> --- >>> src/lib/eo/eo_base_class.c | 7 +++++-- >>> 1 file changed, 5 insertions(+), 2 deletions(-) >>> >>> diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c >>> index a050585..fe9cc5f 100644 >>> --- a/src/lib/eo/eo_base_class.c >>> +++ b/src/lib/eo/eo_base_class.c >>> @@ -16,6 +16,7 @@ typedef struct >>> { >>> Eina_List *children; >>> Eo *parent; >>> + Eina_List *parent_list; >>> >>> Eina_Inlist *generic_data; >>> Eo ***wrefs; >>> @@ -115,8 +116,9 @@ _eo_base_parent_set(Eo *obj, Eo_Base_Data *pd, Eo >>> *parent_id) >>> old_parent_pd = eo_data_scope_get(pd->parent, EO_BASE_CLASS); >>> if (old_parent_pd) >>> { >>> - old_parent_pd->children = >>> eina_list_remove(old_parent_pd->children, >>> - obj); >>> + old_parent_pd->children = >>> eina_list_remove_list(old_parent_pd->children, >>> + >>> pd->parent_list); >>> + pd->parent_list = NULL; >>> } >>> else >>> { >>> @@ -138,6 +140,7 @@ _eo_base_parent_set(Eo *obj, Eo_Base_Data *pd, Eo >>> *parent_id) >>> pd->parent = parent_id; >>> parent_pd->children = eina_list_append(parent_pd->children, >>> obj); >>> + pd->parent_list = eina_list_last(parent_pd->children); >>> eo_xref(obj, pd->parent); >>> } >>> else >>> >> >> Thanks! >> >> I wonder if we can find a way to fix it and not allocate the extra >> pointers, but this is definitely better than what was there. > > That was a quick fix for the issue. I have been thinking, but I > couldn't really find an easy solution that would not cost to much > memory and still be fast for a lookup. Only solution I could see would > be to use an inline rbtree, but that was going to make the code way > more complex and not as fast... So I did stick with that additional > pointer. >
Yeah. I can't think of anything faster/slimmer at the moment. -- Tom. ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
