Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aDz4c-0007AH-QO for pgsql-jdbc@arkaria.postgresql.org; Tue, 29 Dec 2015 18:32:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aDz4c-0006er-Bw for pgsql-jdbc@arkaria.postgresql.org; Tue, 29 Dec 2015 18:32:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aDz4b-0006ek-UK for pgsql-jdbc@postgresql.org; Tue, 29 Dec 2015 18:32:41 +0000 Received: from mbx.knossos.net.nz ([202.160.48.10]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aDz4P-0005zE-2f for pgsql-jdbc@postgresql.org; Tue, 29 Dec 2015 18:32:38 +0000 Received: from [10.1.1.3] (dynamic-cpe-pool.orcon.net.nz [121.98.103.53] (may be forged)) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id tBTIVu8C030887 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 30 Dec 2015 07:32:02 +1300 Subject: Re: PgJDBC: code reformat To: Steven Schlansker , Dave Cramer References: <062c01d14031$c4f01aa0$4ed04fe0$@eu> <567FEF32.9010300@archidevsys.co.nz> <567FF2A3.8060003@archidevsys.co.nz> <56805192.4040901@archidevsys.co.nz> <5681A6AC.3040308@archidevsys.co.nz> <88C4C2A2-C6B3-4B7C-82F1-345147982C79@gmail.com> Cc: Vladimir Sitnikov , Markus KARG , List From: Gavin Flower Organization: ArchiDevSys Message-ID: <5682D19B.6000006@archidevsys.co.nz> Date: Wed, 30 Dec 2015 07:31:55 +1300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <88C4C2A2-C6B3-4B7C-82F1-345147982C79@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org On 29/12/15 11:39, Steven Schlansker wrote: > JMH is an awesome harness for constructing exactly these sorts of performance tests: > http://openjdk.java.net/projects/code-tools/jmh/ > > If we care about driver performance, it might be interesting to construct > some representative tests and include them as part of the build process, to > ensure that metrics we care about don't get regressions. Obviously this would be > some work that needs volunteers interested in working on it, just an idea to think on. > > > And while we're bikeshedding, I personally would -1 the "only one exit per function". > > Sometimes it's nice to bail early e.g. : > > if (offset == length) { return 0; } > ... do work ... > return result; [...] Sorry , don't have time to reply in depth, possibly in about a week (holiday). Only one exit per function works best when it is an absolute rule - with possibly very rare exceptions, and I've yet to see a valid exception in over 40 years of programming. In practice, having multiple returns is unnecessary & makes code harder to read. Remember the Just-in-Time compiler is very good at optimising, even way back in the JDK 1.6 days, and we're now up to 1.8! Cheers, Gavin -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc