Re: equal() perf tweak - Mailing list pgsql-patches

From Tom Lane
Subject Re: equal() perf tweak
Date
Msg-id 3623.1068056555@sss.pgh.pa.us
Whole thread Raw
In response to Re: equal() perf tweak  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
I said:
> No, lfirst and friends will need to apply to ListCells not to Lists,
> else the coding of foreach loops will break everywhere.  I think there
> are many more places that will want lfirst to apply to a ListCell than
> will want it to apply to a raw List.

On the other hand, we will need to touch every foreach loop anyway to
update the datatype of the iteration variable.  I can see merit in the
idea of *deliberately* breaking any un-updated code by means of removing
the lfirst and lnext macros completely.  If we go that path, we could
use names like

    nextcell(cl)        replaces lnext()
    cellvalue(cl)        replaces lfirst()
    cellvaluei(cl)        replaces lfirsti()
    cellvalueo(cl)        replaces lfirsto()

plus invent names like ListFirst(), ListSecond(), etc for the cases
where you really are fetching the n'th element of a List rather than
the contents of the current ListCell.

I'm not wedded to these particular naming suggestions, just thinking
that maybe backwards-compatibility of the macro names isn't such a hot
idea after all.  What do you think?

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: equal() perf tweak
Next
From: Gaetano Mendola
Date:
Subject: Re: equal() perf tweak