From: Gnanavel S <s.gnanavel@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Performance of loop
Date: Thu, 28 Apr 2005 09:26:32 +0530
Message-ID: <eec3b03c050427205669495af0@mail.gmail.com> (raw)
Hi,
First of all, I would like to thank the postgresql team for providing this
wonderful product.
Coming to the point, in postgresql jdbc driver coding, I saw many
inefficient "for" loops. For eg in V2Query.class file
While parsing the parameterized query, there is a "for" loop as this
for (int i = 0; i < query.length(); ++i)
{
char c = query.charAt(i);
....
.....
}
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);
....
.....
}
with regards,
S.Gnanavel
Software Engineer
Satyam Computer Services Ltd
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: s.gnanavel@gmail.com
Subject: Re: Performance of loop
In-Reply-To: <eec3b03c050427205669495af0@mail.gmail.com>
References: <eec3b03c050427205669495af0@mail.gmail.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