X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2EE0652ADB for ; Wed, 10 Aug 2005 05:16:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96362-04 for ; Wed, 10 Aug 2005 08:16:15 +0000 (GMT) Received: from smtp1.freeserve.com (smtp1.wanadoo.co.uk [193.252.22.158]) by svr1.postgresql.org (Postfix) with ESMTP id A040852C20 for ; Wed, 10 Aug 2005 05:16:14 -0300 (ADT) Received: from me-wanadoo.net (nullmx.kyokofukada.net [127.0.0.1]) by mwinf3004.me.freeserve.com (SMTP Server) with ESMTP id D6C971C001C4; Wed, 10 Aug 2005 10:16:14 +0200 (CEST) Received: from 192.168.0.102 (modem-951.lynx.dialup.pol.co.uk [217.135.195.183]) by mwinf3004.me.freeserve.com (SMTP Server) with ESMTP id 4F61B1C001C3; Wed, 10 Aug 2005 10:16:14 +0200 (CEST) X-ME-UUID: 20050810081614325.4F61B1C001C3@mwinf3004.me.freeserve.com Subject: Re: COPY FROM performance improvements From: Simon Riggs To: Luke Lonergan Cc: Tom Lane , Alon Goldshuv , pgsql-patches@postgresql.org In-Reply-To: References: Content-Type: text/plain Organization: 2nd Quadrant Date: Wed, 10 Aug 2005 09:15:00 +0100 Message-Id: <1123661700.3670.621.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200508/85 X-Sequence-Number: 17032 On Tue, 2005-08-09 at 21:48 -0700, Luke Lonergan wrote: > The key thing that is missing is the lack of micro-parallelism in the > character processing in this version. By "inverting the loop", or putting > the characters into a buffer on the outside, then doing fast character > scanning inside with special "fix-up" cases, we exposed long runs of > pipeline-able code to the compiler. > > I think there is another way to accomplish the same thing and still preserve > the current structure, but it requires "strip mining" the character buffer > into chunks that can be processed with an explicit loop to check for the > different characters. While it may seem artificial (it is), it will provide > the compiler with the ability to pipeline the character finding logic over > long runs. The other necessary element will have to avoid pipeline stalls > from the "if" conditions as much as possible. This is a key point, IMHO. That part of the code was specifically written to take advantage of processing pipelines in the hardware, not because the actual theoretical algorithm for that approach was itself faster. Nobody's said what compiler/hardware they have been using, so since both Alon and Tom say their character finding logic is faster, it is likely to be down to that? Name your platforms gentlemen, please. My feeling is that we may learn something here that applies more widely across many parts of the code. Best Regards, Simon Riggs