Dllist public/private part

From: "Mendola Gaetano" <mendola(at)bigfoot(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Dllist public/private part
Date: 2003-07-01 03:25:06
Message-ID: 000f01c33f80$60b31a20$10d4a8c0@mm.eutelsat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm improving the Dllist in these direction:

1) Avoid "if" statements in insertion/remove phase, for instance now the
AddHeader appear like this:

void
DLAddHead(Dllist *l, Dlelem *e)
{
Dlelem *where = l->dll_master_node->dle_next;
e->dle_next = where;
e->dle_prev = where->dle_prev;

where->dle_prev->dle_next = e;
where->dle_prev = e;

e->dle_list = l;

}

2) Not using a malloc but using a "special" malloc that not perform
a malloc for each request but do a BIG malloc at first request...

In the file dllist.h is not clear what is the public part and the private
part
of the implementation in particulary I see that somewhere in the code
there is the assumption that an Empty dllist is "zeroed" instead of
use DLInitList, for example this is the way to initialize a struct that
contain a Dllist itself:

cp = (CatCache *) palloc0(sizeof(CatCache) + NCCBUCKETS * sizeof(Dllist));

this break my optimization because in my implementation a
dllist is

typedef struct Dllist
{
Dlelem *dll_master_node;
} Dllist;

and not anymore:

typedef struct Dllist
{
Dlelem *dll_head;
Dlelem *dll_tail;
} Dllist;

and is empty if list->dll_master_node->dle_next and
list->master_node->dle_prev are pointing to
list->master_node ( previously allocated in DLInitList).

What should I do ? Forget the point 1) ?

Regards
Gaetano Mendola

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sailesh Krishnamurthy 2003-07-01 06:33:04 Re: 2PC: discussion in comp.arch
Previous Message Jon Jensen 2003-07-01 02:45:47 sslmode patch