Some simple JDBC profiling results

Поиск
Список
Период
Сортировка
Искать

Some simple JDBC profiling results

От:
"j.random.programmer" <javadesigner@yahoo.com>
Дата:
Hi, just FYI.

I ran a profiler recently on some java code (part of
which was using
the postgres JDBC driver) and saw the following
hotspots within the driver:

org.postgresql.core.Encoding.decode (line: 193)
org.postgresql.core.Encoding.decode (line: 347)

I think there might be excessive new String creation
at those points
cause those 2 lines really light up the profiler.

Best regards,
--j

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Some simple JDBC profiling results

От:
Oliver Jowett <oliver@opencloud.com>
Дата:
j.random.programmer wrote:

> I ran a profiler recently on some java code (part of
> which was using
> the postgres JDBC driver) and saw the following
> hotspots within the driver:
> 
> org.postgresql.core.Encoding.decode (line: 193)
> org.postgresql.core.Encoding.decode (line: 347)
> 
> I think there might be excessive new String creation
> at those points
> cause those 2 lines really light up the profiler.

As pointed out by others there is not "excessive string creation" as 
those methods are explicitly designed to return a new String .. The 
issue is probably that the callers use it too much. If you attribute the 
cost of Encoding.decode() to its callers, what do the hotspots look like 
then?

It looks that Encoding.getDatabaseEncoding() actually fails to return 
the specialized UTF8Encoding when it could, so we're still using the 
generic version (which works, but is slower) .. I suspect I didn't test 
that properly when I last modified that code. But if String creation is 
really the problem, then that's not going to help you anyway.

-O

FAQ