From: Oliver Jowett <oliver@opencloud.com>
To: Gnanavel S <s.gnanavel@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Performance of loop
Date: Thu, 28 Apr 2005 16:22:27 +1200
Message-ID: <42706503.7080800@opencloud.com> (raw)
In-Reply-To: <eec3b03c050427205669495af0@mail.gmail.com>
References: <eec3b03c050427205669495af0@mail.gmail.com>
Gnanavel S wrote:
> In the above coding, say if the length of the query is 1000 characters
> then the query.length() is evaluated 1000 times there by reducing the
> performance.
> I think the loop can be rewritten as
>
> for (int i = 0,c=query.length(); i < c; ++i)
> {
> char c = query.charAt(i);
>
> ....
> .....
> }
Have you benchmarked this? I doubt it's really a hotspot given that the
JIT is likely to inline length(). Premature optimization and all that..
-O
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, s.gnanavel@gmail.com
Subject: Re: Performance of loop
In-Reply-To: <42706503.7080800@opencloud.com>
References: <eec3b03c050427205669495af0@mail.gmail.com> <42706503.7080800@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox