[postgis-users] postgis performance

Markus Schaber schabi at logix-tt.com
Mon Aug 8 00:49:19 PDT 2005


Hi, Xavier,

Xavier Vanderstukken wrote:

> Use a StringBuffer to concatenate String, this tips avoid String objects
> creation (dont forget to set the StringBuffer initial size to the
> estimatate total size).

It is interesting to know that most JAVA compilers (at least the SUN and
IBM javacs since 1.2) seem to do this optimization internally in most
cases. You can see this when using step-by-step debugging through the code.

Btw, when writing code for java 1.5/5 (and newer), it makes much sense
to use StringBuilder instead of StringBuffer in most cases, as the first
one is much faster (but not thread safe).

HTH,
Markus



More information about the postgis-users mailing list