On Tue, 8 Sep 2009 20:52:39 -0300 Gustavo Sverzut Barbieri
<barbi...@profusion.mobi> said:

you've already put my word in on this. i go the accounting way. 1. it is
consistent with eina_list. 2. can be extended beyond last and include count and
many other things. 3. doesn't change inlist struct size to be bigger (tho we
dont win on it being smaller). 4. doesnt play evil games. (using low-order bits
in pointers is wrong imho. i've sen this game played before (using high order
bits) and then it com crashing down on peoples heads when suddenly those used
bits become relevant. using those bits will also require instruction overhead
of masking them out always before use. so you lose on the code simplicity and
speed side, just to save 4 bytes (or 8 on 64bit) per inlist instance. it's not
worth it. it is possible also in future allocations no longer are limited to
word boundaries and allocs do use those bits, thus removing them from our use
and requiring another solution.

in the end. it's safer, easier, faster, more consistent and more portable and
robust to use the accounting pointer method

> Hello all, but specially Cedric and Jorge as one of you did initial
> eina_inlist and we're about to release eina as 1.0 so we need to know
> if things need/could be changed to improve things before that.
> 
> Today eina_inlist does not keep an accounting member as its eina_list
> counterpart, instead it keeps a pointer to "last" that is just valid
> on the head member (as we'll not walk the list updating all ->last as
> we append stuff). That leaves us with a sizeof(pointer) lost in every
> member but the first.
> 
> Two options with that:
>    - add accounting: suggested by raster, it does make sense as it
> would make eina_inlist_count() O(1) and behavior similar to eina_list,
> better use of that pointer.
>    - ultra-dirty hack to remove extra pointer. The hack bases on the
> fact that we just use ->last from the first node, that always have the
> ->prev == NULL. So we could have the first ->prev == ->last, but how
> to know it's the first then, you might ask? Easy! Just use the fact
> that valid addresses are multiple of sizeof(word) and you're done, no
> supported platform uses less than 4 bytes, so ->prev = ->last | 1;
> would work, and checks  for ->last & 1 would tell you if it's the case
> or not.
> 
> The ultra dirty hack could be used to save the extra ->accounting from
> eina_list as well, and instead of adding last as said in the previous
> example, we could store accounting there. Dirty but useful, if people
> are using macros then we've almost no porting to do. As this uses
> ->prev (a not so used pointer in outer world) we don't have much work
> to do, just introduce EINA_LIST_FIRST_IS() and EINA_LIST_LAST_IS()
> (the last would still check for NULL, but just to make further changes
> easier).
> 
> What do you think? Should we change eina_inlist to have an accounting
> and still use 3 pointers per node? Should we move to the said trick?
> Also for eina_list? SAY IT SOON OR LIVE WITH THAT :-D
> 
> -- 
> Gustavo Sverzut Barbieri
> http://profusion.mobi embedded systems
> --------------------------------------
> MSN: barbi...@gmail.com
> Skype: gsbarbieri
> Mobile: +55 (19) 9225-2202
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to