Hi Alvin,
Try first a simple special treatment to dates retrieved from
database. I bet the added milliseconds for each row you display are due
to intensive CPU usage of Date.toString() calls.
This happens in the line where you display each row:
/** pw here is the response's PrintWriter.. */
pw.println(" .... " + rs.getDate("date") + ... );
Try these instead:
Create an java.text.SimpleDateFormat instance variable:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMMMM dd");
(or what ever formatting you like. All needed info is in the javadoc for
java.text.SimpleDateFormat, more info in java.text.DateFormat ans
java.text.Format classes)
and use that sdf to print dates with:
pw.println(... + sdf.format(rs.getDate("date")) + ... );
That's faster because the Date.toString() method creates a new DateFormat
each time it is called, instead to reusing it.
Also some of such optimisations might be handled within JDBC drivers,
try also to use rs.getString("date") - instead of getDate("date").
Cezar.
Reality is an obstacle to hallucination.
On Mon, 26 Jul 1999, C.P. Lau wrote:
> Cezar,
>
> Personally I think the problem are:
>
> mysql jdbc driver->AS you seen the result of 1st test are v. close (just
> 3ms). Just after I added some db features, php became more and more
> faster the servlet. mm mysql seems to be the most stable jdbc driver for
> mysql. And I cannot use other DBMS.
>
> blackdown jdk->I know blackdown jdk is relatively slow, but it seems that
> it is the best vm on linux. The one from IBM caused me a lot of trouble
> (took me > 2hrs to install because I have to upgrade my glibc. Some of my
> old prg. throwed exceptions that it never happened before)
>
> jserv->jserv team did a nice work, but it's relatively slow (servletrunner
> is faster).
>
>
> alvin
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html