Patch: FYI: Calendar.newInstance() optimization

Bryce McKinlay mckinlay@redhat.com
Sat Jul 10 02:37:00 GMT 2004


This patch speeds up the Calendar.newInstance() by avoiding 
Class.forName() calls and reflection instantiation of the calendar class 
in the most common case. It does this by keeping a cache of 
Locale->Calendar class mappings, and constructing the calendar object 
directly if it sees GregorianCalendar.class - by far the most common case.

This further speeds up the DateTester.java test case, from 17s to 10s on 
my machine.

Regards

Bryce

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Calendar-newInstance.patch
Type: text/x-patch
Size: 3736 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040710/0267cdd0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DateTester.java
Type: text/x-java
Size: 414 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040710/0267cdd0/attachment-0001.bin>


More information about the Java-patches mailing list