harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Hu (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-4064) [classlib][luni] Performance improvement of java.util.HashMap
Date Fri, 13 Jul 2007 02:15:04 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Robert Hu closed HARMONY-4064.
------------------------------


Verified.
Thanks a lot!

> [classlib][luni] Performance improvement of java.util.HashMap
> -------------------------------------------------------------
>
>                 Key: HARMONY-4064
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4064
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Robert Hu
>            Assignee: Tim Ellison
>         Attachments: HARMONY-4064.diff
>
>
> The performance of HashMap can be improved, the hash method is improved.
> By running the following test code, our HashMap can be improved from 110% time cost (compared
by RI) to 90% time cost (compared by RI).
> public class TestHashMap {
>     public static void main(String[] args) {
>         Random ran = new Random();
>         HashMap map = new HashMap();
>         int elementNum = 500;
>         int times = 10000;
>         int[] rans = new int[elementNum];
>         for (int i = 0; i < elementNum; i++)
>             rans[i] = ran.nextInt(Integer.MAX_VALUE);
>         long start = System.currentTimeMillis();
>         for (int i = 0; i < elementNum; i++)
>             map.put(rans[i], "b");
>         System.out.println(System.currentTimeMillis() - start);
>         start = System.currentTimeMillis();
>         for (int i = 0; i < elementNum; i++)
>             for(int j = 0; j< times; j++){
>                 map.get(rans[i]);
>             }
>         System.out.println(System.currentTimeMillis() - start);        
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message