Hi,

On Sun, 2005-12-11 at 14:20 +0100, Guilhem Lavaux wrote:
> Using ant we may have discovered that multiple creation of a 
> SimpleDateFormat object can lead to a big slowdown. I am proposing the 
> addition of a simple cache system. LocaleCache would cache 
> ResourceBundle objects and some parsed strings in a WeakHashMap. If it 
> is needed LocaleCache will create these objects and in the other case 
> extract them directly from the cache.
> 
> This patch shows DateFormatSymbols can be easily modified to follow this 
> scheme.

If you are really seeing big speedups then this makes sense. Do you have
an indication of how much time/resources are involved?

Some comments on this patch.
- The cache can be accessed from multiple Threads so all access should
be synchronized.
- When does Locale.toString() every return the empty String?
- In getZoneStrings() you now catch/handle the case of a
MissingResourceException. Why wasn't this needed before? Does this
change the semantics?

- The use of ClassLoader.getSystemClassLoader() cannot be done in all
context. If you know this is safe here (I believe it is) then you can
use a doPrivilieged() call here. Or maybe even add a new Action for
getting the System Class Loader in gnu.java.security.action since it is
done more often in the core classes. (This was wrong in the original
code so isn't a new issue. If you decide not to fix it then please file
a bug report for it.)

Minor nitpicks:

- There are multiple lines > 80 chars.
- There should be spaces around all operators like + or =.

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to