On Mon, Aug 04, 2014 at 10:32:19PM +0100, Michael Treibton wrote:

> Hi all,
> 
> I'm in the process of changing over some code of mine from hand-rolled
> lists to using TAILQ and friends from queue.h
> 
> In reading the documentation, I note it says the following about TAILQ
> (and similar for other macros):
> 
>         Code size is about 15% greater and operations run about 20%
> slower than lists.
> 
> Would someone mind enlightening me where this statistic has come from,
> how it's measured, and if there's any practical considerations a
> programmer could use to either reduce the running times, or at least
> not exceed it?
> 
> Or failing that, is the comment in the documentation worth mentioning at all?
> 
> Thanks all!
> 
> Michael

AFAIK The numbers given are based on measurements given the various
SLIST, LIST, TAILQ and other macros. Given that their interfaces are
very similar, it is easy to measure relative performance and code
size. 

I think it is good the rough relative performance numbers of the
various lists types are stated, it helps in choosing the right data
structure for the problem at hand. I most cases, choosing the simplest
data structure that has the functions you need for your program will
give you very reasonable if not fast performance. An exception might
be TAILQ, which does have backward traversal, but at a cost. 

        -Otto

Reply via email to