pgsql: Save a few bytes by removing useless last argument to SearchCatC

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Save a few bytes by removing useless last argument to SearchCatC
Date: 2018-01-29 20:13:30
Message-ID: E1egFo2-0005vv-7b@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-01-29 20:16:59 Re: pgsql: Initialize unused ExprEvalStep fields.
Previous Message Andres Freund 2018-01-29 20:07:06 pgsql: Initialize unused ExprEvalStep fields.