You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2007/07/09 14:23:04 UTC

[jira] Resolved: (HARMONY-4064) [classlib][luni] Performance improvement of java.util.HashMap

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

Tim Ellison resolved HARMONY-4064.
----------------------------------

    Resolution: Fixed

Thanks Robert.

After discussion on the mailing list:

http://mail-archives.apache.org/mod_mbox/harmony-dev/200706.mbox/%3c5c8e69f0706270310k38a93b99oa84e92d7d54220c4@mail.gmail.com%3e
http://mail-archives.apache.org/mod_mbox/harmony-dev/200707.mbox/%3c5c8e69f0707032218i159b99cbu84b29a5d469469eb@mail.gmail.com%3e

the performance improvement was fixed in the LUNI module at repo revision r554615.  Note that we are expecting the VMs' implementation of identityHashCode to improve to make best use of this improvement.

Please check it was applied as you expected.


> [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.