Re: RFC: Make new versions of pgjdbc Java8+

From: Álvaro Hernández Tortosa <aht(at)8kdata(dot)com>
To: rado(at)edno(dot)moe
Cc: Daniel Migowski <dmigowski(at)ikoffice(dot)de>, Dave Cramer <pg(at)fastcrypt(dot)com>, John R Pierce <pierce(at)hogranch(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>, pgsql-jdbc-owner(at)postgresql(dot)org
Subject: Re: RFC: Make new versions of pgjdbc Java8+
Date: 2017-04-03 19:42:43
Message-ID: 971a86da-3576-1a1d-e80a-40038bf9793b@8kdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 03/04/17 21:34, rado(at)edno(dot)moe wrote:
> Hello Alvaro,
>
> On 2017-04-03 21:53, Álvaro Hernández Tortosa wrote:
>> On 03/04/17 20:47, Daniel Migowski wrote:
>>
>>> Hello Alvaro,
>>>
>>> while the biggest performance hit currently in the driver is the
>>> switch to java.util.Logging (i will come up with numbers regarding
>>> that in a few days, comparing it to previous versions). Currently,
>>> and comparing to the 9.3 driver with the current driver, the
>>> Hibernate databases checks take twice the time than before! Even if
>>> some parts have improved (see changes in PGStream and
>>> VisibleBufferedInputStream, nice reuse of arrays there since 9.3)
>>> other things have changed to the bad.
>>>
>>> I also already did my tests regarding the stuff below, and concluded
>>> that in our company lambda’s are useful in the GUI, but as I said
>>> shouldn’t be used on the server. In my tests they were about 50%
>>> percent slower in the long run.
>>>
>>> Streams are the same thing… just look at the stack traces! Good
>>> for rarely used stuff, but honestly I prefer a nice loop where you
>>> see what is happening in terms of object creation over streams that
>>> might be concise, but are not needed. At least not for something you
>>> call potentially 100ths of times a second.
>>
>> While I agree Lambdas and Streams should be used with care, I'm
>> still unconvinced that they really take a hit in performance (if the
>> compiler is not optimizing that, which most of the time does). I would
>> really love to see some numbers to prove my wrong in this respect. But
>> I don't see much trends towards not using them in the Java world (but
>> the contrary) and I talk to very performance conscious people.
>
> I've remembered about this writing:
> http://blog.takipi.com/benchmark-how-java-8-lambdas-and-streams-can-make-your-code-5-times-slower/
>
> They have the code available, I haven't verified it personally. Also
> it is possible the outcome to be different with the newer releases of
> the JDK. Please note the difference between the original results and
> the updated ones.
>
> The base line is: you have to be extra careful with the streams,
> autoboxing and to avoid using lamdas in "hot" places. At least for the
> tested use case - "sorting ArrayList populated with 100 000 random
> integers".

Yeah, that's exactly what I meant: they should be used with care.
But that is quite different from never using them at all :)

Thank you for the link, I read that in the past and is a good example.

Cheers,

Álvaro

--

Álvaro Hernández Tortosa

-----------
<8K>data

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Brad DeJong 2017-04-03 19:47:40 Re: RFC: Make new versions of pgjdbc Java8+
Previous Message rado 2017-04-03 19:34:44 Re: RFC: Make new versions of pgjdbc Java8+