Replace the switching function ExecEvalExpr() with a macro that jumps
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/executor/execQual.c | modified | +367 −281 |
| src/backend/executor/nodeHash.c | modified | +3 −3 |
| src/backend/executor/nodeMergejoin.c | modified | +5 −9 |
| src/backend/executor/nodeSubplan.c | modified | +10 −2 |
| src/include/executor/executor.h | modified | +13 −6 |
| src/include/executor/nodeSubplan.h | modified | +3 −2 |
| src/include/nodes/execnodes.h | modified | +15 −3 |