Re: Some simple JDBC profiling results - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Some simple JDBC profiling results
Date
Msg-id 44ED2671.3070709@opencloud.com
Whole thread Raw
In response to Some simple JDBC profiling results  ("j.random.programmer" <javadesigner@yahoo.com>)
List pgsql-jdbc
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


pgsql-jdbc by date:

Previous
From: "j.random.programmer"
Date:
Subject: Re: Some more profiling hotspots
Next
From: "surabhi.ahuja"
Date:
Subject: Re: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend