benchmarks/Hash.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 20 Feb 2013 23:05:49 +0000
branchdevelopment
changeset 2380 9195eccdcbd9
parent 2069 75d40b7b986f
parent 2353 fa7400d022a0
child 2429 ebece4dcaab9
permissions -rw-r--r--
Merged 08505399cea8 and 0adf7bbcf2c9 (branch default - CVS HEAD)

"{ 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_CVS
    ^ '$Header: /cvs/stx/stx/libjava/benchmarks/Hash.st,v 1.1 2013-02-16 18:08:32 vrany Exp $'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '§Id::                                                                                                                        §'
! !