ok, seems nice :-)

On Fri, Oct 26, 2012 at 9:14 PM, Jérémy Zurcher <[email protected]> wrote:
> well,
> it took me time to come back, lots of work these days,
>
> On Tuesday 23 October 2012  19:28, Gustavo Sverzut Barbieri wrote :
>> 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.
> just like trunk does,
> I can't break something that doet not work, hence the 3 attached patches.
>
> there is no way to set EINA_SHARE_USAGE and EINA_SHARE_COMMON_USAGE
> through configure but we can set EINA_STRINGSHARE_USAGE ... chose your patch
>>
>> There are some coding style issues and going over some abstraction
>> such as accessing the RB tree in order to speed up.
>>
> I try my best to follow it.
> going over the RB tree is the point, having to live with calls to
> _eina_share_common_cmp is no good.
>> 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?
> I used the provided eina_bench_stringshare.c which focuses only on
> eina_stringshare_add() whih is the path I was trying to speed up.
> e17 bench brings undesired behaviours
>   - varying strings length which impact hash_superfast timing
>   - calls to eina_stringshare_ref and eina_stringshare_del
> RB patch is not trying to find a real data best fitting algo,
> but to shorten a given path which is data independant..
>
> yes it is marginal, but still it's faster with my patch than running
> lockless see the e17 benchmark numbers as you prefer them:
>
> For `eina-trunk`:
> # specimen      experiment time starting time   ending time
> 1               5138136         19947069256     19952207392
>
> For `eina-trunk-lockless (lock calls commented)`:
> # specimen      experiment time starting time   ending time
> 1               5108452         19934390545     19939498997
>
> For `eina-RB-patched (with lock)`:
> # specimen      experiment time starting time   ending time
> 1               5089091         19882278972     19887368063
>
> will be even better with the other patch which serves long strings first,
> that is real data targeting.
>>
>> note: AFAIR the biggest impact of the stringshare was the locks to
>> make it multithread safe :-/
> it is marginal, I've been told by benchmarks and gprof.
>
> Cheers
> Jérémy
>
>>
>> --
>> 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
>
> --
> Jérémy Zurcher
> av General Guisan 49
> 1400 Yverdon-les-bains
> +41 (0) 79 599 84 27
>
> ------------------------------------------------------------------------------
> WINDOWS 8 is here.
> Millions of people.  Your app in 30 days.
> Visit The Windows 8 Center at Sourceforge for all your go to resources.
> http://windows8center.sourceforge.net/
> join-generation-app-and-make-money-coding-fast/
> _______________________________________________
> enlightenment-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>



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

------------------------------------------------------------------------------
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to