| From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
|---|---|
| To: | Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz> |
| Cc: | Steven Schlansker <stevenschlansker(at)gmail(dot)com>, 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:33:55 |
| Message-ID: | CADK3HHKz1DGhNOoCjCQAST6p-4cDrU_Xw7aE3t+1GfMWD2TJ8w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-jdbc |
On 29 December 2015 at 13:31, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
wrote:
> 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!
>
> I actually find this easier to read as the logic is clear.
Cheers,
Dave
>
> Cheers,
> Gavin
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vladimir Sitnikov | 2015-12-29 19:07:20 | Backend protocol wanted features |
| Previous Message | Gavin Flower | 2015-12-29 18:31:55 | Re: PgJDBC: code reformat |