Re: Some simple JDBC profiling results

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: "j(dot)random(dot)programmer" <javadesigner(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Some simple JDBC profiling results
Date: 2006-08-24 04:09:21
Message-ID: 44ED2671.3070709@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2006-08-24 05:56:38 Re: [JDBC] org.postgresql.util.PSQLException: An I/O error occured
Previous Message j.random.programmer 2006-08-24 03:25:16 Re: Some more profiling hotspots