Robert Haas <[email protected]> writes:
> Right. I think it is a niche case, but I also don't think this is
> really costing us anything. As far as I can tell from my benchmarking
> to date, fmgr_info() is kind of expensive, but fmgr_info_copy() is
> pretty cheap. So, we could arrange to share a single flinfo for every
> argument of the VARIADIC list, but the savings are pretty limited
> because we wouldn't save fmgr_info() calls, only fmgr_info_copy()
> calls.
The hole in that argument is that fmgr_info_copy() does
dstinfo->fn_extra = NULL;
so that if the function-to-be-called caches anything in fn_extra,
it will have to populate that cache for each argument. That could be
quite expensive. It might still not justify complicating the setup
code, but I don't think it's as clear-cut as you suggest. Perhaps
some benchmarking is in order.
regards, tom lane