The previous patch set doesn't accept --enable-cassert. The attached additional one fixes it. It theoretically won't give degradation but I'll measure the performance change.
At Thu, 21 Jul 2016 18:50:07 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyot...@lab.ntt.co.jp> wrote in <20160721.185007.268388411.horiguchi.kyot...@lab.ntt.co.jp> > Hello, > > At Tue, 12 Jul 2016 11:42:55 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI > <horiguchi.kyot...@lab.ntt.co.jp> wrote in > <20160712.114255.156540680.horiguchi.kyot...@lab.ntt.co.jp> > After some refactoring, degradation for a simple seqscan is > reduced to 1.4% and that of "Append(SeqScan())" is reduced to > 1.7%. The gains are the same to the previous measurement. Scale > has been changed from previous measurement in some test cases. > > t0- (SeqScan()) (2 parallel) > pl- (Append(4 * SeqScan())) > pf0 (Append(4 * ForeignScan())) all ForeignScans are on the same connection. > pf1 (Append(4 * ForeignScan())) all ForeignScans have their own connections. > > > patched-O2 time(ms) stddev(ms) gain from unpatched (%) > t0 4121.27 1.1 -1.44 > pl 1757.41 0.94 -1.73 > pf0 6458.99 192.4 20.26 > pf1 1747.4 24.81 78.39 > > unpatched-O2 > t0 4062.6 1.95 > pl 1727.45 9.41 > pf0 8100.47 24.51 > pf1 8086.52 33.53 > > > > Addition to the aboves, I will try reentrant ExecAsyncWaitForNode > > > or something. > > After some consideration, I found that ExecAsyncWaitForNode > cannot be reentrant because it means that the control goes into > async-unaware nodes while having not-ready nodes, that is > inconsistent state. To inhibit such reentering, I allocated node > identifiers in depth-first order so that ascendant-descendant > relationship can be checked (nested-set model) in simple way and > call ExecAsyncConfigureWait only for the descendant nodes of the > parameter planstate. -- Kyotaro Horiguchi NTT Open Source Software Center
>From 2a6a95a038948a7a4384f44ef99a9a454175a47c Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horiguchi.kyot...@lab.ntt.co.jp> Date: Fri, 22 Jul 2016 17:07:34 +0900 Subject: [PATCH 8/8] Change two macros into inline functions. ExecConsumeResult cannot have Assertion in the form of macro. So this patch alters it into a function. ExecReturnTuple is also changed for the reason of uniformity. This might reduce performance (it theoretically won't be happen but I believe I saw it..) --- src/include/executor/executor.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index c1ef2ab..8e55b54 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -231,20 +231,25 @@ extern void ExecEndNode(PlanState *node); extern bool ExecShutdownNode(PlanState *node); /* Convenience function to set a node's result to a TupleTableSlot. */ -#define ExecReturnTuple(node, slot) \ -{ \ - Assert(!(node)->result_ready); \ - (node)->result = (Node *) (slot); \ - (node)->result_ready = true; \ +static inline void ExecReturnTuple(PlanState *node, TupleTableSlot *slot); +static inline void +ExecReturnTuple(PlanState *node, TupleTableSlot *slot) +{ + Assert(!(node)->result_ready); + (node)->result = (Node *) (slot); + (node)->result_ready = true; } /* Convenience function to retrieve a node's result. */ -#define ExecConsumeResult(node) \ -( \ - Assert((node)->result_ready), \ - Assert((node)->result == NULL || IsA((node)->result, TupleTableSlot)), \ - (node)->result_ready = false, \ - (TupleTableSlot *) node->result) +static inline TupleTableSlot *ExecConsumeResult(PlanState *node); +static inline TupleTableSlot * +ExecConsumeResult(PlanState *node) +{ + Assert(node->result_ready); + Assert(node->result == NULL || IsA(node->result, TupleTableSlot)); + node->result_ready = false; + return (TupleTableSlot *) node->result; +} /* -- 1.8.3.1
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers