On Tue, Oct 23, 2012 at 7:30 PM, Jérémy Zurcher <[email protected]> wrote:
>
> Hi,
>
> I wanted to try to speed up eina_stringshare_del,
> but I ended touching eina_stringshare_add first.
>
> p0.patch: _eina_share_common_find_hash(…)
>             merges _eina_share_common_cmp and calls to 
> eina_rbtree_inline_lookup
>
> p1.patch: eina_stringshare API
>             treat big strings first and avoid a call from eina_stringshare_add

p1 breaks del accounting of population, while I don't think it will
make any difference:

--- a/eina/src/lib/eina_stringshare.c
+++ b/eina/src/lib/eina_stringshare.c
@@ -582,28 +582,17 @@ eina_stringshare_del(Eina_Stringshare *str)
      return;

    /* special cases */
-   if (str[0] == '\0')
-     slen = 0;
-   else if (str[1] == '\0')
-     slen = 1;
-   else if (str[2] == '\0')
-     slen = 2;
-   else if (str[3] == '\0')
-     slen = 3;
-   else
-     slen = 4;  /* handled later */
-
-   if (slen < 2)
+   if (str[0] == '\0' || str[1] == '\0')
      return;
-   else if (slen < 4)
+   else if (str[2] == '\0' || str[3] == '\0')
      {
+        slen =  (str[2] == '\0') ? 2 : 3;
         eina_share_common_population_del(stringshare_share, slen);
         eina_lock_take(&_mutex_small);
         _eina_stringshare_small_del(str, slen);
         eina_lock_release(&_mutex_small);
         return;
      }

eina_share_common_population_del() will not run for sizes 0 and 1.

There are some coding style issues and going over some abstraction
such as accessing the RB tree in order to speed up.

From the images the speed up seems quite marginal and I wonder how you
tested it. We provide the e17 benchmark that uses real-word strings,
it's better than some random synthetic test. Did you run this? could
you check with that?

note: AFAIR the biggest impact of the stringshare was the locks to
make it multithread safe :-/

--
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [email protected]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to