diff options
author | Elijah C. Menifee <[email protected]> | 2010-08-23 03:02:43 +0800 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-06 03:49:25 +0100 |
commit | 4c808ec572808a221d0ce08785dad2d18f77ea5f (patch) | |
tree | 1505e48475d97d3a8422aaf335fee75edd6b922d /src/java/com/sun/gluegen/ReferencedStructs.java | |
parent | 0674c42c0b18073b53a09300d0f60373f1463665 (diff) |
Fixed benchmarking bugs in primitive HashMap test.
Both IntIntHashMapTest and LongIntHashMapTest failed to reset test start time.
The time values for intmapGetTime,mapGetTime,intmapRemoveTime,and mapRemoveTime
all used the start time value from mapPutTime. This caused the following to be
always/guarenteed to be true:
mapPutTime < intmapGetTime < mapGetTime < intmapRemoveTime < mapRemoveTime
thus not actually testing the following asserts:
assertTrue("'get' too slow", intmapGetTime <= mapGetTime);
assertTrue("'remove' too slow", intmapRemoveTime <= mapRemoveTime);
In addition the results of the test were being printed before the actual test
ran.
Changed code to reset time to System.nanoTime() prior to each for loop, and
moved time calculation and result output to below the test for loop.
I also improved the output of the test info, by including the warmup status
on benchmark start.
Diffstat (limited to 'src/java/com/sun/gluegen/ReferencedStructs.java')
0 files changed, 0 insertions, 0 deletions