From: | Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz> |
---|---|
To: | Steven Schlansker <stevenschlansker(at)gmail(dot)com>, Dave Cramer <pg(at)fastcrypt(dot)com> |
Cc: | Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, Markus KARG <markus(at)headcrashing(dot)eu>, List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: PgJDBC: code reformat |
Date: | 2015-12-29 18:31:55 |
Message-ID: | 5682D19B.6000006@archidevsys.co.nz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-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
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2015-12-29 18:33:55 | Re: PgJDBC: code reformat |
Previous Message | Dave Cramer | 2015-12-29 14:53:39 | Re: PgJDBC: code reformat |