Re: Improve list manipulation in several places

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: Improve list manipulation in several places
Date: 2023-04-21 11:16:01
Message-ID: CAEudQArQSosP9qNR62M6_44t_iicQ4f9JAWmB5nriRccx-TfeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sex., 21 de abr. de 2023 às 04:34, Richard Guo <guofenglinux(at)gmail(dot)com>
escreveu:

> There was discussion in [1] about improvements to list manipulation in
> several places. But since the discussion is not related to the topic in
> that thread, fork a new thread here and attach a patch to show my
> thoughts.
>
> Some are just cosmetic changes by using macros. The others should have
> performance gain from the avoidance of moving list entries. But I doubt
> the performance gain can be noticed or measured, as currently there are
> only a few places affected by the change. I still think the changes are
> worthwhile though, because it is very likely that future usage of the
> same scenario can benefit from these changes.
>
+1

Perhaps list_delete_nth_cell needs to check NIL too?
+ if (list == NIL)
+ return NIL;

+lcons_copy(void *datum, const List *list)
+lappend_copy(const List *list, void *datum)
list param pointer can be const here not?

regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Borisov 2023-04-21 11:21:24 Re: duplicate function declaration in multirangetypes_selfuncs.c
Previous Message Daniel Gustafsson 2023-04-21 11:14:45 Re: duplicate function declaration in multirangetypes_selfuncs.c