I would suggest to change toDayOfWeek and toMonth methods to simple static arrays. We do not need these calls and switches in this case.
Thanks in advance. SY, Alexey 2008/8/27 Jim Yu <[EMAIL PROTECTED]>: > Hi all, > > I took a look at [1] and found that we can remove the delegation to > SimpleDateFormat since we only use the en-us locale here. > I think we can easily implement this method instead of delegating to > SimpleDateFormat. Then, this defect can be easily resolved. > Moreover, invoking SimpleDateFormat will lead to low performance of this > API. For a simple testcase as below [2], the original > result is 119667 millisecs while the result after applying my patch is only > 1140 millisecs. I've attached my patch to this JIRA. > Is there anyone to verify the patch? Thanks. > > [1] https://issues.apache.org/jira/browse/HARMONY-5468 > [2] > import java.util.Date; > > public class DateToStringTest { > > public static void main(String[] args) { > long start = System.currentTimeMillis(); > Date date = new Date(); > long count = 100000; > System.out.println(date.toString()); > while(--count != 0) { > date.toString(); > } > System.out.println(System.currentTimeMillis() - start); > } > } > -- > Best Regards, > Jim, Jun Jie Yu > > China Software Development Lab, IBM >
