[Serdev] Clist doubt

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Jun 3 19:24:42 CEST 2008


On Jun 03, 2008 at 10:35, Nuno Ribeiro <nribeiro82 at gmail.com> wrote:
> Dear All,
> 
> I was looking into the code of the TM module and I saw that all the "for"
> loops were replaced by clist methods (clist_foreach), defined in "clist.h".
> I would like to understand what kind of differences in terms of performance
> this changes induce in the SER?

This change has an extremely small performance impact. It was done
 when I've switched tm to use atomic ref. counters for freeing the
 cells, mostly for cleanup purposes.
Tha being said insert and delete are faster (removed 1 "if" from insert
and 2 from remove) and the code looks cleaner.
Another related change was inserting at the beginning, rather then at
the end. This tends to shorten the search for an already existing
transaction (there is a higher probablility that if you create a
transaction, it would be needed before the older ones).
The switch to delete on refcnt==0 instead of relying on the delete_timer
is probably the most important from the performance point of view: both
less memory is used, since the dead transaction are freed earlier and
this also keeps the hashlists shorter resulting in better performance.

Another small change related to performance and the list for loop is the
 attempt to prefetch the next cell into the cache.


Andrei


More information about the Serdev mailing list