**** All tests run on i7-2600K CPU, Linux 3.6, JDK8 64bit server JIT ** Original JDK8 IdentityHashMap vs. HashMap Executing: /home/peter/Apps64/jdk1.8.0-jdk8-tl/bin/java -server -Xmx4G -cp ../out/production/test test.IdentityHashMapTest reference size=5, HashMap.capacity=8, IdentityHashMap.capacity=8, loops=20000000 HashMap.keySet().toArray(): 353,547,830 336,259,433 314,534,778 314,162,971 314,035,385 312,895,665 311,799,393 314,037,326 IdentityHashMap.keySet().toArray(): 1,269,394,101 1,170,807,030 1,159,771,167 1,161,336,504 1,159,049,104 1,173,521,515 1,168,947,651 1,165,488,047 HashMap.values().toArray(): 1,074,503,335 1,068,626,622 1,067,647,539 1,059,467,643 1,067,483,735 1,061,296,532 1,061,185,562 1,051,016,629 IdentityHashMap.values().toArray(): 1,443,719,778 1,428,514,260 1,446,997,849 1,447,975,537 1,452,554,512 1,428,004,888 1,426,182,446 1,430,961,571 HashMap.entrySet().toArray(): 1,163,719,227 1,156,696,113 1,159,183,605 1,155,314,974 1,170,884,400 1,158,763,914 1,147,552,881 1,147,680,620 IdentityHashMap.entrySet().toArray(): 1,793,156,690 1,779,352,275 1,748,122,938 1,784,863,747 1,778,785,323 1,786,244,490 1,764,799,867 1,770,748,429 size=10, HashMap.capacity=16, IdentityHashMap.capacity=16, loops=10000000 HashMap.keySet().toArray(): 1,094,762,025 1,089,438,887 1,085,942,641 1,084,589,657 1,085,334,936 1,089,868,232 1,086,273,201 1,086,865,525 IdentityHashMap.keySet().toArray(): 1,384,262,237 1,375,322,411 1,376,019,602 1,376,204,966 1,381,898,449 1,375,837,662 1,381,894,836 1,377,414,718 HashMap.values().toArray(): 1,065,846,946 1,074,272,367 1,067,028,722 1,068,137,138 1,067,354,898 1,074,650,569 1,066,943,473 1,073,803,022 IdentityHashMap.values().toArray(): 1,349,632,670 1,346,163,019 1,345,076,858 1,357,407,298 1,346,625,510 1,351,224,576 1,349,825,728 1,346,312,629 HashMap.entrySet().toArray(): 1,080,244,279 1,086,291,621 1,071,484,624 1,075,227,744 1,068,925,337 1,079,188,331 1,067,125,058 1,069,287,041 IdentityHashMap.entrySet().toArray(): 1,724,093,247 1,715,438,568 1,721,034,880 1,718,049,323 1,717,080,009 1,746,651,353 1,734,110,328 1,711,068,896 size=20, HashMap.capacity=32, IdentityHashMap.capacity=32, loops=5000000 HashMap.keySet().toArray(): 1,027,496,242 1,022,883,129 1,023,472,227 1,022,922,796 1,023,777,206 1,023,462,029 1,034,871,927 1,022,366,313 IdentityHashMap.keySet().toArray(): 1,208,021,524 1,207,191,139 1,208,040,351 1,207,243,020 1,214,678,602 1,208,572,296 1,212,244,943 1,208,092,594 HashMap.values().toArray(): 1,014,082,993 1,014,196,495 1,013,310,038 1,013,920,755 1,016,574,166 1,013,598,161 1,015,326,906 1,014,315,930 IdentityHashMap.values().toArray(): 1,185,086,260 1,187,690,385 1,187,749,755 1,191,331,260 1,186,392,201 1,186,228,336 1,185,721,209 1,186,669,939 HashMap.entrySet().toArray(): 1,006,052,392 1,005,137,773 1,005,348,055 1,008,444,565 1,005,270,856 1,005,284,313 1,005,253,302 1,006,045,781 IdentityHashMap.entrySet().toArray(): 1,626,400,004 1,617,387,609 1,629,689,829 1,610,217,968 1,619,797,280 1,640,136,114 1,615,088,131 1,625,575,673 size=50, HashMap.capacity=128, IdentityHashMap.capacity=128, loops=2000000 HashMap.keySet().toArray(): 1,040,442,130 1,040,266,393 1,040,400,135 1,040,424,533 1,040,376,533 1,040,440,578 1,040,335,122 1,040,392,982 IdentityHashMap.keySet().toArray(): 1,215,356,276 1,215,407,113 1,217,658,369 1,214,645,740 1,214,643,165 1,214,661,924 1,214,658,904 1,214,678,745 HashMap.values().toArray(): 1,036,784,269 1,036,870,332 1,036,753,963 1,036,862,131 1,044,556,895 1,037,002,379 1,037,363,981 1,036,907,951 IdentityHashMap.values().toArray(): 1,195,708,941 1,195,558,759 1,195,957,517 1,195,047,946 1,195,460,822 1,195,476,723 1,196,268,705 1,195,168,393 HashMap.entrySet().toArray(): 1,045,974,894 1,046,654,385 1,046,212,590 1,047,060,011 1,046,468,150 1,046,571,108 1,046,099,105 1,048,324,665 IdentityHashMap.entrySet().toArray(): 1,620,665,937 1,626,113,330 1,627,724,296 1,634,947,532 1,609,226,575 1,640,234,307 1,638,538,855 1,629,441,988 size=100, HashMap.capacity=256, IdentityHashMap.capacity=256, loops=1000000 HashMap.keySet().toArray(): 1,039,554,103 1,034,199,032 1,034,257,053 1,034,486,457 1,034,387,925 1,034,084,023 1,034,096,553 1,033,855,219 IdentityHashMap.keySet().toArray(): 1,188,861,990 1,188,461,673 1,188,790,505 1,195,909,024 1,192,314,303 1,192,098,234 1,192,190,688 1,192,166,764 HashMap.values().toArray(): 1,032,280,097 1,032,228,144 1,032,282,773 1,032,219,841 1,032,194,600 1,032,307,572 1,034,357,684 1,033,305,812 IdentityHashMap.values().toArray(): 1,182,411,685 1,182,149,271 1,182,322,556 1,182,514,471 1,182,219,919 1,182,281,479 1,182,013,880 1,182,342,949 HashMap.entrySet().toArray(): 1,035,881,455 1,036,834,630 1,035,751,836 1,035,803,729 1,035,577,649 1,038,535,625 1,035,683,945 1,034,917,029 IdentityHashMap.entrySet().toArray(): 1,665,946,652 1,657,038,373 1,656,870,480 1,641,320,308 1,669,752,143 1,646,860,179 1,646,686,456 1,647,135,922 size=10000, HashMap.capacity=16384, IdentityHashMap.capacity=16384, loops=10000 HashMap.keySet().toArray(): 1,578,361,930 1,567,852,569 1,569,604,892 1,567,082,810 1,567,374,499 1,568,511,477 1,567,295,835 1,569,994,143 IdentityHashMap.keySet().toArray(): 1,433,148,461 1,433,296,863 1,433,444,648 1,433,519,920 1,433,416,340 1,434,049,279 1,433,695,616 1,434,333,506 HashMap.values().toArray(): 1,568,206,738 1,569,393,858 1,567,048,695 1,567,101,014 1,566,261,739 1,567,565,633 1,565,735,291 1,568,318,493 IdentityHashMap.values().toArray(): 1,415,611,533 1,415,220,369 1,415,713,156 1,415,397,918 1,415,365,496 1,415,662,795 1,415,412,206 1,415,473,230 HashMap.entrySet().toArray(): 1,555,499,818 1,554,753,833 1,556,336,639 1,553,543,247 1,554,779,183 1,554,568,078 1,554,506,446 1,554,395,688 IdentityHashMap.entrySet().toArray(): 1,876,789,133 1,885,102,621 1,888,619,077 1,900,201,468 1,873,864,366 1,893,435,084 1,887,320,023 1,885,570,278 ** Patched IdentityHashMap vs. original HashMap Executing: /home/peter/Apps64/jdk1.8.0-jdk8-tl/bin/java -server -Xmx4G -cp ../out/production/test -Xbootclasspath/p:../out/production/jdk test.IdentityHashMapTest size=5, HashMap.capacity=8, IdentityHashMap.capacity=8, loops=20000000 HashMap.keySet().toArray(): 344,082,899 330,664,561 321,052,132 321,077,946 321,037,751 321,039,861 320,994,681 321,263,711 IdentityHashMap.keySet().toArray(): 407,690,449 375,510,668 375,220,105 375,120,012 375,217,308 375,250,670 375,119,809 375,234,076 HashMap.values().toArray(): 1,085,981,411 1,073,877,084 1,052,982,444 1,047,584,052 1,050,929,260 1,051,180,247 1,055,973,573 1,049,009,088 IdentityHashMap.values().toArray(): 370,904,787 366,665,141 360,423,276 357,282,145 357,263,658 357,350,157 357,275,067 357,266,547 HashMap.entrySet().toArray(): 1,089,143,738 1,082,651,953 1,090,877,162 1,092,052,668 1,090,799,917 1,083,183,200 1,082,014,712 1,101,947,318 IdentityHashMap.entrySet().toArray(): 905,065,541 889,036,030 885,292,351 887,953,166 895,536,393 880,198,134 874,011,282 869,572,710 size=10, HashMap.capacity=16, IdentityHashMap.capacity=16, loops=10000000 HashMap.keySet().toArray(): 1,069,241,074 1,053,812,651 1,052,544,284 1,053,490,896 1,057,231,912 1,052,470,890 1,052,703,906 1,053,518,118 IdentityHashMap.keySet().toArray(): 383,534,635 383,939,854 383,632,352 383,586,037 383,900,883 383,818,079 383,914,005 383,900,567 HashMap.values().toArray(): 1,033,075,514 1,032,320,193 1,039,624,888 1,034,956,942 1,032,431,659 1,033,272,574 1,034,135,446 1,039,599,043 IdentityHashMap.values().toArray(): 302,873,157 302,814,515 302,859,072 302,809,427 302,831,695 302,968,788 302,853,690 302,857,041 HashMap.entrySet().toArray(): 1,021,390,367 1,023,145,232 1,023,675,379 1,020,576,251 1,025,544,819 1,023,518,607 1,024,692,857 1,022,475,112 IdentityHashMap.entrySet().toArray(): 824,266,390 820,936,898 811,642,680 813,294,300 821,160,372 815,609,688 813,037,515 818,483,190 size=20, HashMap.capacity=32, IdentityHashMap.capacity=32, loops=5000000 HashMap.keySet().toArray(): 992,094,311 986,638,474 992,346,726 986,606,999 987,391,790 986,507,597 987,141,741 986,595,743 IdentityHashMap.keySet().toArray(): 297,224,213 297,096,770 296,953,645 296,867,120 296,748,753 296,988,378 297,018,566 297,032,994 HashMap.values().toArray(): 978,625,656 977,779,563 978,146,668 977,845,593 978,313,966 978,569,190 977,831,930 982,430,312 IdentityHashMap.values().toArray(): 225,445,024 225,388,961 225,398,300 225,397,343 225,394,060 225,388,311 225,397,670 225,404,791 HashMap.entrySet().toArray(): 967,590,406 964,788,486 964,344,635 963,984,632 965,273,074 964,749,360 968,964,459 968,266,844 IdentityHashMap.entrySet().toArray(): 746,681,258 752,620,594 741,127,856 734,344,524 752,321,203 741,748,176 734,688,872 740,424,249 size=50, HashMap.capacity=128, IdentityHashMap.capacity=128, loops=2000000 HashMap.keySet().toArray(): 1,020,078,104 1,015,286,454 1,015,027,607 1,033,516,972 1,027,047,546 1,023,606,604 1,027,217,024 1,024,010,465 IdentityHashMap.keySet().toArray(): 316,288,326 315,958,751 315,808,100 315,644,093 316,021,521 315,677,505 316,343,720 315,957,193 HashMap.values().toArray(): 1,019,022,113 1,019,388,931 1,018,043,461 1,023,803,334 1,023,891,219 1,030,834,605 1,024,251,137 1,024,026,469 IdentityHashMap.values().toArray(): 238,903,938 238,908,387 238,860,031 239,123,491 238,905,969 238,863,699 238,892,628 238,941,906 HashMap.entrySet().toArray(): 1,006,799,520 1,006,137,420 1,006,259,179 1,006,935,105 1,006,281,174 1,006,048,468 1,007,224,605 1,006,353,896 IdentityHashMap.entrySet().toArray(): 765,009,798 754,477,341 757,226,679 766,893,608 754,154,774 764,314,611 764,629,247 760,388,875 size=100, HashMap.capacity=256, IdentityHashMap.capacity=256, loops=1000000 HashMap.keySet().toArray(): 1,016,032,859 1,009,062,417 1,011,020,208 1,007,095,117 1,007,067,158 1,007,089,026 1,007,215,820 1,008,889,647 IdentityHashMap.keySet().toArray(): 310,572,097 310,668,655 310,319,109 310,787,163 310,557,016 310,984,987 310,874,370 310,632,678 HashMap.values().toArray(): 999,971,948 999,799,997 999,811,868 999,795,629 999,825,755 1,000,775,450 999,688,589 999,668,687 IdentityHashMap.values().toArray(): 235,580,275 235,548,685 235,535,129 235,540,026 235,532,653 235,521,035 235,531,111 235,545,415 HashMap.entrySet().toArray(): 1,001,165,560 1,000,895,142 1,001,844,685 1,001,331,382 1,010,086,730 1,000,596,422 1,000,920,131 1,000,448,031 IdentityHashMap.entrySet().toArray(): 772,485,448 767,397,117 769,477,518 777,466,965 756,808,676 769,033,221 762,389,386 765,135,927 size=10000, HashMap.capacity=16384, IdentityHashMap.capacity=16384, loops=10000 HashMap.keySet().toArray(): 1,557,145,771 1,547,636,907 1,547,662,087 1,547,791,650 1,548,920,693 1,550,410,643 1,547,546,691 1,547,591,040 IdentityHashMap.keySet().toArray(): 536,164,346 536,360,765 536,675,137 536,473,879 536,799,011 536,512,511 536,355,464 536,063,435 HashMap.values().toArray(): 1,548,215,318 1,548,033,642 1,549,583,480 1,548,626,217 1,547,229,370 1,547,548,945 1,547,550,253 1,547,438,678 IdentityHashMap.values().toArray(): 341,385,329 340,273,611 340,759,892 340,459,101 340,498,779 339,632,007 339,665,874 340,395,923 HashMap.entrySet().toArray(): 1,537,018,985 1,532,681,795 1,532,962,301 1,532,508,092 1,532,026,549 1,533,069,461 1,532,243,072 1,536,082,344 IdentityHashMap.entrySet().toArray(): 1,057,222,345 1,050,968,423 1,045,044,722 1,040,377,167 1,045,828,978 1,057,760,650 1,060,643,308 1,055,160,587