Dllist public/private part
От | Mendola Gaetano |
---|---|
Тема | Dllist public/private part |
Дата | |
Msg-id | 000f01c33f80$60b31a20$10d4a8c0@mm.eutelsat.org обсуждение исходный текст |
Ответы |
Re: Dllist public/private part
|
Список | 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 firstrequest... 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
В списке pgsql-hackers по дате отправления: