benchmarks/Hash.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 07 May 2013 13:31:03 +0100
branchdevelopment
changeset 2591 17d9c39d3ab4
parent 2573 59aeefc96cf4
child 2711 a00302fe5083
permissions -rw-r--r--
Merged a98037ca2d11 and b09eaedf206a (branch java-exception-optimization)

"{ 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.2 2013-02-25 11:15:32 vrany Exp $'
!

version_HG

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

version_SVN
    ^ '§Id::                                                                                                                        §'
! !