This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: java.util.Date.toString() really slow?


Jeff Sturm wrote:

I missed the original post so I haven't seen Adam's example, but I'll
hazard a guess based on my observations.

Date.toString() relies on the Calendar code, which in turn loads a
resource bundle.  ResourceBundle looks first for a localized bundle, e.g.
Calendar_en_US.  Since this doesn't exist it falls back to Calendar_en.
Moreover java.util.ResourceBundle doesn't cache failures, so it tends to
search the library path each time a Calendar is instantiated.

Presumably it would be reasonable to cache negative results for resource bundle (and class?) lookups. People don't expect to be able to dynamically add new resource bundles to a running application, right?

regards

Bryce.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]