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

Bryce McKinlay bryce@waitaki.otago.ac.nz
Mon Jun 3 20:21:00 GMT 2002


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.




More information about the Java mailing list