pgsql: Save a few bytes by removing useless last argument toSearchCatC - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Save a few bytes by removing useless last argument toSearchCatC
Date
Msg-id E1egFo2-0005vv-7b@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Save a few bytes by removing useless last argument to SearchCatCacheList.

There's never any value in giving a fully specified cache key to
SearchCatCacheList: you might as well call SearchCatCache instead,
since there could be only one match.  So the maximum useful number of
key arguments is one less than the supported number of key columns.
We might as well remove the useless extra argument and save some few
bytes per call site, as well as a cycle or so per call.

I believe the reason it was coded like this is that originally, callers
had to write out all the dummy arguments in each call, and so it seemed
less confusing if SearchCatCache and SearchCatCacheList took the same
number of key arguments.  But since commit e26c539e9, callers only write
their live arguments explicitly, making that a non-factor; and there's
surely been enough time for third-party modules to adapt to that coding
style.  So this is only an ABI break not an API break for callers.

Per discussion with Oliver Ford, this might also make it less confusing
how to use SearchCatCacheList correctly.

Discussion: https://postgr.es/m/27788.1517069693@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/97d4445a033f1cc02784d42561b52b3441c8eddd

Modified Files
--------------
src/backend/utils/cache/catcache.c |  9 +++++++--
src/backend/utils/cache/syscache.c |  4 ++--
src/include/utils/catcache.h       |  2 +-
src/include/utils/syscache.h       | 10 ++++------
4 files changed, 14 insertions(+), 11 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Initialize unused ExprEvalStep fields.
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Initialize unused ExprEvalStep fields.