[Opensource] SimpleDateFormat

Ben Switzer ben at site85.com
Thu Mar 13 08:44:27 PST 2003


That makes sense.

So Michael, how would I in a wrapper make use of the cache you've
already setup in JDBCUtil?

Ben

-----Original Message-----
From: opensource-admin at jcorporate.com
[mailto:opensource-admin at jcorporate.com] On Behalf Of Michael Rimov
Sent: Thursday, March 13, 2003 1:06 AM
To: opensource at jcorporate.com
Subject: RE: [Opensource] SimpleDateFormat


At 11:53 AM 3/12/2003 -0500, you wrote:
>SimpleDateFormat is not thread safe and if date formatting becomes a 
>global resource then you are synchronizing a fairly expensive operation

>across the entire application. There are many reasons why you may want 
>to format a date (logging, setting headers, etc.) on a per page basis 
>and synchronizing on every page request is not a good thing.


Vincent,

What you've suggested is certainly a possibility.  One thing I've
noticed 
in profiling, however, is that the expensive part of creating a
DateFormat 
object is the creation and not the actual formatting.  By caching and 
sharing date format instances (even synchronized), CPU time slices for
that 
particular chunk of code dropped from 15% to 5%.  [Which is what I did
in 
JDBC executor]

So given that, I think sharing a pool of SimpleDate instances would 
ultimately reap the highest performance, and sharing a single one would 
suffice over creating non-synchronized local copies up to considerable
scaling.

Hope this clarifies!
                                                 -Mike




_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/




More information about the Opensource mailing list