Figure 3 shows the results of the Long
arithmetic test, which replaces the 64-bit double variables with 64-bit long
variables. Here is the pseudocode:
while (i < Max) { Result -= i++ Result *= i++ Result += i++ Result /= i++ }
Figure 3: Results.
The trigonometric functions test runs the sin
, cos
, tan
, log10
, and sqrt
functions in a loop, performed with 64-bit double arithmetic. Figure 4 presents the results. Here is the pseudocode:
while (i < Max) { sine += sin(i) cosine += cos(i) tangent += tan(i) logarithm +=log10(i) squareRoot += sqrt(i) i++ }
Figure 4: Trigonometric functions.
File I/O performs a write/read of 8,100,000 bytes in/from a text file. Starting with this test, each subsequent test is done 10 times. Figure 5 shows the results. Here is the pseudocode:
while (i < Max) { writeLine ("abcdefghijklmno...") i++ } while (not eof) { result += readLine() }
Figure 5: File I/O.
The array test measures the basic array set
and get
functions, including allocation of the required memory. Figure 6 shows the results. Here is the pseudocode:
while (i < Max) { x[i] = i + 1 y[i] = 0 i++ } while (k < 1000) { while (j < Max) { y[j] += x[j] j++ } k++ }
Figure 6: Array.
Exception handling creates 2x50000 exceptions, which are interleaved. Figure 7 shows the results. Here is the pseudocode:
while (i < Max) { try { try { if ( i is odd ) { throw new lo_Exception } else { throw new hi_Exception } } catch(lo_exception) { Lo++ } } catch(hi_exception) { Hi++ } i++ }
Figure 7: Exception.
A single hash map is filled with 32-bit integers via a string key in this test. Then a find
is performed with a 62.5 percent success ratio of all values; see Figure 8. Here is the pseudocode:
while (i < Max) { insert value of i with key of i as hex string into hash map i++ } i=0 while (i < Max) { if( hash map contains key of i as decimal string ) { result++ } i++ }
Figure 8: Single hash map.
This time, two hash maps are used. One is filled and iterated to perform find
, get
, and set
operations on the second. Figure 9 shows the results. Here is the pseudocode:
while (i < 10000) { insert value of i with key of i as decimal string into hash map1 i++ } i=0 while (i < Max) { for each entry in hash map1 { if( hash map2 contains key of hash map1 entry) { hash map2 entry value += hash map1 entry value } else { insert hash map1 entry value into hash map2 via hash map1 entry key } } i++ }
Figure 9: Multiple hash map.