benchmarks/Hash.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 23 Jan 2013 12:31:33 +0000
branchdevelopment
changeset 1988 0fcf5a5dcb66
parent 1818 2e5ed72e7dfd
child 2014 9fa66342102b
permissions -rw-r--r--
Cleanup in JavaRelease: javaHome/jreHome/jdkHome.

"{ Package: 'stx:libjava/benchmarks' }"

JavaBenchmark subclass:#Hash
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Benchmarks-Java-Micro'
!


!Hash methodsFor:'running'!

runBenchmarkS:n 
    | count  table |

    count := 0.
    table := Dictionary new:n + (n // 5).
    ^ Time 
        millisecondsToRun:[
            1 to:n do:[:each | 
                table at:(each printStringRadix:16) put:each
            ].
            1 to:n do:[:each | 
                (table includesKey:(each printStringRadix:10)) ifTrue:[
                    count := count + 1
                ]
            ].
        ].
! !

!Hash class methodsFor:'documentation'!

version_SVN
    ^ '$Id::                                                                                                                        $'
! !