From 3b8ba163d0511a238971c165ffeeb9abdeaceb7c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 4 Oct 2002 17:19:55 +0000 Subject: Tweak a few of the most heavily used function call points to zero out just the significant fields of FunctionCallInfoData, rather than MemSet'ing the whole struct to zero. Unused positions in the arg[] array will thereby contain garbage rather than zeroes. This buys back some of the performance hit from increasing FUNC_MAX_ARGS. Also tweak tuplesort.c code for more speed by marking some routines 'inline'. All together these changes speed up simple sorts, like count(distinct int4column), by about 25% on a P4 running RH Linux 7.2. --- src/backend/executor/nodeAgg.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/backend/executor/nodeAgg.c') diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 0ebf2f7151e..36ded53df0c 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -46,7 +46,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.88 2002/09/28 20:00:19 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.89 2002/10/04 17:19:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -275,8 +275,18 @@ advance_transition_function(AggStatePerAgg peraggstate, } } - /* OK to call the transition function */ - MemSet(&fcinfo, 0, sizeof(fcinfo)); + /* + * OK to call the transition function + * + * This is heavily-used code, so manually zero just the necessary fields + * instead of using MemSet(). Compare FunctionCall2(). + */ + + /* MemSet(&fcinfo, 0, sizeof(fcinfo)); */ + fcinfo.context = NULL; + fcinfo.resultinfo = NULL; + fcinfo.isnull = false; + fcinfo.flinfo = &peraggstate->transfn; fcinfo.nargs = 2; fcinfo.arg[0] = peraggstate->transValue; -- cgit v1.2.3