benchmarks/Hash.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 11 Feb 2014 15:10:40 +0000
branchdevelopment
changeset 3029 bc928fce0f14
parent 2731 13f5be2bf83b
child 3107 d1d41053a1c8
permissions -rw-r--r--
Merged 6d6f9fd894f7 and c04668cd040d

"{ 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.3 2013-09-06 00:41:32 vrany Exp $'
!

version_HG

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

version_SVN
    ^ 'Id::                                                                                                                        '
! !