list rewrite committed

Lists: pgsql-hackers
From: Neil Conway <neilc(at)samurai(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: list rewrite committed
Date: 2004-05-26 04:47:26
Message-ID: 40B4215E.2090806@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I've applied the list rewrite patch to CVS HEAD. I've also sent a
copy of the patch I applied to the -patches list.

Notes:

- the tree compiles without warnings and passes the regression
tests. I'm not aware of any bugs, regression failures, or compiler
warnings caused by the list rewrite patch -- please let me know if
you encounter anything

- client code that uses the List API is _not_ source compatible with
the new List API. The most common change will be the need to change
the foreach() iteration variable to a ListCell*, rather than a
List*. There are also some subtle changes in behavior: for example,
lcons() is now destructive (in the sense that you cannot call it on
a list and expect the list you pass to lcons() to be unmodified;
this was the case with the old list API)

Remaining work:

- investigate inline functions for non-GCC compilers

- disable the use of the compatibility API throughout the tree and
change the code over to use the new API function names. This ought
to be largely a mechanical search and replace operation -- any
patches are welcome. I plan to start converting the remainder of the
tree in this fashion tomorrow.

- use the new for_each_cell() and forboth() macros throughout the
tree, as appropriate.

- remove the FastList API -- there is no need for it anymore. Tom,
would you like to do this or should I?

- anything else?

Thanks to Tom and Alvaro for their assistance in completing this work.

-Neil


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list rewrite committed
Date: 2004-05-26 05:34:29
Message-ID: 40B42C65.2080001@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> - anything else?

All compiles and passes regression tests on FreeBSD...

Chris


From: Jeff <threshar(at)torgo(dot)978(dot)org>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list rewrite committed
Date: 2004-05-26 15:09:30
Message-ID: B038EAC6-AF26-11D8-B225-000D9366F0C4@torgo.978.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On May 26, 2004, at 12:47 AM, Neil Conway wrote:

> I've applied the list rewrite patch to CVS HEAD. I've also sent a copy
> of the patch I applied to the -patches list.

Nifty.

Do we have any numbers as to how much this will help things?

If not, would something like a pg_bench exercise the new code enough to
see the results?

--
Jeff Trout <jeff(at)jefftrout(dot)com>
http://www.jefftrout.com/
http://www.stuarthamm.net/


From: Neil Conway <neilc(at)samurai(dot)com>
To: Jeff <threshar(at)torgo(dot)978(dot)org>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list rewrite committed
Date: 2004-05-27 19:36:53
Message-ID: 40B64355.1020907@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jeff wrote:
> Do we have any numbers as to how much this will help things?

No, I haven't done any benchmarking yet (I might do some before I
leave for the summer, but it's not a priority...)

FWIW, the performance improvement from this patch won't be as large
as it might be, since Tom already replaced some lappend() hot spots
with the "FastList" code. The new list API makes that optimization
global, so we'll fix anywhere that fell through the cracks.

> If not, would something like a pg_bench exercise the new code enough to
> see the results?

Something like TPC-H would be better, I'd think.

-Neil


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Jeff <threshar(at)torgo(dot)978(dot)org>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list rewrite committed
Date: 2004-05-28 06:09:14
Message-ID: 15359.1085724554@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Neil Conway <neilc(at)samurai(dot)com> writes:
>> If not, would something like a pg_bench exercise the new code enough to
>> see the results?

> Something like TPC-H would be better, I'd think.

You'd only be likely to notice a difference in queries with hundreds of
selected columns, CASE expressions with hundreds of alternatives, that
kind of thing. I doubt that any of the standard benchmarks really
stress this sort of problem.

As Neil mentioned, we'd already tamped down the more common cases with
the FastList kluge. But there definitely are cases that we'd not
covered with FastList, some because it was notationally impractical
and some because we'd just not noticed a problem. For instance, here
http://archives.postgresql.org/pgsql-hackers/2004-03/msg00696.php
are some profiles documenting a case where nearly 40% of the runtime
goes into lappend's in 7.4. I haven't had time to repeat the test case
but I'd think that time is near-zero in CVS tip.

regards, tom lane


From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: list rewrite committed
Date: 2004-05-28 13:24:38
Message-ID: 877juwd6qx.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> For instance, here
> http://archives.postgresql.org/pgsql-hackers/2004-03/msg00696.php are some
> profiles documenting a case where nearly 40% of the runtime goes into
> lappend's in 7.4. I haven't had time to repeat the test case but I'd think
> that time is near-zero in CVS tip.

Of course now ExecEvalExpr's share of runtime in that test is probably up to
28-35% in those tests. Or did you get to doing the things you proposed with
making it a macro?

--
greg


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: list rewrite committed
Date: 2004-05-28 16:44:35
Message-ID: 27890.1085762675@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Greg Stark <gsstark(at)mit(dot)edu> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> For instance, here
>> http://archives.postgresql.org/pgsql-hackers/2004-03/msg00696.php are some
>> profiles documenting a case where nearly 40% of the runtime goes into
>> lappend's in 7.4. I haven't had time to repeat the test case but I'd think
>> that time is near-zero in CVS tip.

> Of course now ExecEvalExpr's share of runtime in that test is probably up to
> 28-35% in those tests. Or did you get to doing the things you proposed with
> making it a macro?

I did. I'd like to re-run that test, but have no time for it right now
--- too much to do before feature freeze.

regards, tom lane