pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gavin Flower <GavinFlower@archidevsys.co.nz>
To: Steven Schlansker <stevenschlansker@gmail.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Cc: Markus KARG <markus@headcrashing.eu>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: PgJDBC: code reformat
Date: Wed, 30 Dec 2015 07:31:55 +1300
Message-ID: <5682D19B.6000006@archidevsys.co.nz> (raw)
In-Reply-To: <88C4C2A2-C6B3-4B7C-82F1-345147982C79@gmail.com>
References: <CAB=Je-F1PtJ1Dbsswr=oaj2z8KYpZANHW_kLc2y5DuzjpAJqeQ@mail.gmail.com>
	<062c01d14031$c4f01aa0$4ed04fe0$@eu>
	<CAB=Je-GTY_09RLYOA9FgoydadEyiGD+ea+xvDqt7J0ijYnqPfg@mail.gmail.com>
	<CADK3HHLGRSzbWnbkwixGz2dregiBJJMSBtA9NaUt3eYC8RZ+cA@mail.gmail.com>
	<567FEF32.9010300@archidevsys.co.nz>
	<CADK3HHLD3aAWcEPtUXVCxDrLzENvpAGbqC__dYfzrKEz1wh2VA@mail.gmail.com>
	<567FF2A3.8060003@archidevsys.co.nz>
	<CAB=Je-He4RtXP-m2vkD9KKm+vPwFY7y3M-z_cKtmho=tExiJmg@mail.gmail.com>
	<56805192.4040901@archidevsys.co.nz>
	<CADK3HHJkFMo1eYujhnDtzH9z8K2Bh+3BPLx4+9p_U_=4x+6w6w@mail.gmail.com>
	<5681A6AC.3040308@archidevsys.co.nz>
	<CADK3HHLHcLtjtkP30boWtwBn_LGcTQv1-6ZULd_feR0_x0we8Q@mail.gmail.com>
	<88C4C2A2-C6B3-4B7C-82F1-345147982C79@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

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



view thread (33+ messages)  latest in thread

Message-ID: <5682D19B.6000006@archidevsys.co.nz>
Permalink:  ../5682D19B.6000006@archidevsys.co.nz/
Also on:    postgresql.org/message-id/5682D19B.6000006@archidevsys.co.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: GavinFlower@archidevsys.co.nz, stevenschlansker@gmail.com, pg@fastcrypt.com, sitnikov.vladimir@gmail.com, markus@headcrashing.eu
  Subject: Re: PgJDBC: code reformat
  In-Reply-To: <5682D19B.6000006@archidevsys.co.nz>
  References: <CAB=Je-F1PtJ1Dbsswr=oaj2z8KYpZANHW_kLc2y5DuzjpAJqeQ@mail.gmail.com> <062c01d14031$c4f01aa0$4ed04fe0$@eu> <CAB=Je-GTY_09RLYOA9FgoydadEyiGD+ea+xvDqt7J0ijYnqPfg@mail.gmail.com> <CADK3HHLGRSzbWnbkwixGz2dregiBJJMSBtA9NaUt3eYC8RZ+cA@mail.gmail.com> <567FEF32.9010300@archidevsys.co.nz> <CADK3HHLD3aAWcEPtUXVCxDrLzENvpAGbqC__dYfzrKEz1wh2VA@mail.gmail.com> <567FF2A3.8060003@archidevsys.co.nz> <CAB=Je-He4RtXP-m2vkD9KKm+vPwFY7y3M-z_cKtmho=tExiJmg@mail.gmail.com> <56805192.4040901@archidevsys.co.nz> <CADK3HHJkFMo1eYujhnDtzH9z8K2Bh+3BPLx4+9p_U_=4x+6w6w@mail.gmail.com> <5681A6AC.3040308@archidevsys.co.nz> <CADK3HHLHcLtjtkP30boWtwBn_LGcTQv1-6ZULd_feR0_x0we8Q@mail.gmail.com> <88C4C2A2-C6B3-4B7C-82F1-345147982C79@gmail.com> <5682D19B.6000006@archidevsys.co.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox