On Monday 26 November 2012  17:37, Cedric BAIL wrote :
> Hello,
> 
> On Wed, Nov 21, 2012 at 7:39 AM, Jérémy Zurcher <jer...@asynk.ch> wrote:
> > here are 2 patches to speed up eina_share_common_del with minimal costs on
> > eina_share_common_add side.
> >
> > the second might be controversial
> >
> > 0001-eina_share_common_del-speed-up.patch
> >   builtin node is never unlinked even if empty,
> >   always is the last of the queue,
> >   so that it can be used to get a pointer to head.
> >
> >   cost: never unlink or promote builtin node.
> >   benefit: no need to hash and search rbtree to unlink an empty node,
> >   only to remove an empty head.
> 
> It seems good, I am just wondering why you did add a 'if (node->next)'
> in _eina_share_common_head_find. In my opinion, it should never pass
> the test and trigger that case.
> 

it's absolutly mandatory,

let h(x)&0xFFFF==h(y)&0xFFFF==h(z)&0xFFFF -> collision -> uses head's node list
add(x) -> head->builtin(x,1)
add(y) -> head->node(y,1)->builtin(x,1)
add(z) -> head->node(z,1)->node(y,1)->builtin(x,1)
add(x) -> head->builtin(x,2)->node(z,1)->node(y,1)    // promotion in 
_eina_share_common_head_find
del(z) -> to remove empty node(z,0) from the list,
          eina_share_common_head_from_node will use node(y,1) as builtin node 
-> SPANK!!

to prevent this, builtin_node must
  - be the last node (never be promoted)
    _eina_share_common_head_find 'if (node->next)'
  - never be removed from the list even if empty
    eina_share_common_del, 'if (node != &ed->builtin_node) { ... }'

> > 0002-eina_share_common_del-speed-up.patch
> >   store full hash in Eina_Share_Common_Head, so we only hash once
> >   use 8 lower bits as node hash, use next 8 bits as bucket index.
> >
> >   cost: have to apply 0xFF mask on hash in rbtree callbacks.
> >   benefit: no need to hash when removing an empty head.
> 
> Interesting. Did you run the live benchmark ? Applying a 0xFF mask
> should be fast and not impact speed i think.

indeed it has no impact, but collecting good numbers is not easy because
the optimized path implise that we are in hash collision.
I'll try to come back with something this week-end.

attached find a patch to fix eina_benchmark

regards
Jérémy

> --
> Cedric BAIL
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

-- 
Jérémy Zurcher
av General Guisan 49
1400 Yverdon-les-bains
+41 (0) 79 599 84 27
>From f9670ba744928f1d2a6816a44675e17ec87aac36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= <jer...@asynk.ch>
Date: Thu, 29 Nov 2012 09:48:55 +0100
Subject: [PATCH 3/4] fix eina benchmarks

---
 efl/src/benchmarks/eina/eina_bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/efl/src/benchmarks/eina/eina_bench.c 
b/efl/src/benchmarks/eina/eina_bench.c
index 03aaaf9..5bd35f8 100644
--- a/efl/src/benchmarks/eina/eina_bench.c
+++ b/efl/src/benchmarks/eina/eina_bench.c
@@ -55,7 +55,7 @@ static void _mempool_init(void)
    eina_init();
    /* force modules to be loaded in case they are not installed */
    _modules = eina_module_list_get(NULL,
-                                   PACKAGE_BUILD_DIR "/src/modules",
+                                   PACKAGE_BUILD_DIR "/src/modules/eina",
                                    EINA_TRUE,
                                    NULL,
                                    NULL);
-- 
1.8.0.1

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
VERIFY Test and improve your parallel project with help from experts 
and peers. http://goparallel.sourceforge.net
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to