Re: StringBuffer vs. StringBuilder

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Frederik Wiers <frederik(dot)wiers(at)gmail(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: StringBuffer vs. StringBuilder
Date: 2014-01-22 21:11:26
Message-ID: CADK3HHL+ECTxnV0A5VfV-QPP8w3=YY_47Kf5NdB=2CEOUL146w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Frederik,

Statement caching has been a fairly hot topic of late. What would you
expect statement caching to give you ?

Currently we don't really parse the statements. So parsing isn't a huge
overhead, but there is some.
We don't use a named statement on the server so that is relatively quick.

I'd be interested in seeing a proof of concept with some performance
numbers if you have some cycles?

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

On Sun, Jan 19, 2014 at 7:37 PM, Frederik Wiers <frederik(dot)wiers(at)gmail(dot)com>wrote:

> Hello,
>
> suggestion for a small performance improvement: replace StringBuffer with
> StringBuilder when the StringBuffer is used as a local variable in a method.
>
> I just browsed the git-repo (
> https://github.com/pgjdbc/pgjdbc/tree/master/org/postgresql) looking for
> prepared statement caching (which I could not find, but that is for another
> day) and saw a lot of places where StringBuffer can be replaced by
> StringBuilder.
>
> The little performance test shown at
> http://stackoverflow.com/a/2771852/3080094
> indicates that if StringBuffer is used a lot, replacing it with
> StringBuilder can make a difference. And I can not think of a reason to use
> a StringBuffer if it is just used locally in a method to build a String.
>
> Frederik
>
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Florian Weimer 2014-01-23 10:46:42 Re: revisiting unix domain sockets
Previous Message Jeremy Whiting 2014-01-22 21:08:10 Re: Performance improvement proposal. Removal of toLowerCase calls. PR