From c1352052ef1d4eeb2eb1d822a207ddc2d106cb13 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 17 Mar 2004 01:02:24 +0000 Subject: Replace the switching function ExecEvalExpr() with a macro that jumps directly to the appropriate per-node execution function, using a function pointer stored by ExecInitExpr. This speeds things up by eliminating one level of function call. The function-pointer technique also enables further small improvements such as only making one-time tests once (and then changing the function pointer). Overall this seems to gain about 10% on evaluation of simple expressions, which isn't earthshaking but seems a worthwhile gain for a relatively small hack. Per recent discussion on pghackers. --- src/backend/executor/nodeHash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/executor/nodeHash.c') diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 834c7afd6c1..a6a386f97f6 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.82 2004/02/03 17:34:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.83 2004/03/17 01:02:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -532,6 +532,7 @@ ExecHashGetBucket(HashJoinTable hashtable, foreach(hk, hashkeys) { + ExprState *keyexpr = (ExprState *) lfirst(hk); Datum keyval; bool isNull; @@ -541,8 +542,7 @@ ExecHashGetBucket(HashJoinTable hashtable, /* * Get the join attribute value of the tuple */ - keyval = ExecEvalExpr((ExprState *) lfirst(hk), - econtext, &isNull, NULL); + keyval = ExecEvalExpr(keyexpr, econtext, &isNull, NULL); /* * Compute the hash function -- cgit v1.2.3