benchmarks/Hash.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 16 Sep 2013 01:04:57 +0100
branchdevelopment
changeset 2733 3d97124aebf5
parent 2731 13f5be2bf83b
child 3107 d1d41053a1c8
permissions -rw-r--r--
Fixes for syntax highlighting. Even full class source is fully parser and indexed as the parser seems to be fast enough (at least at i5 CPU).

"{ 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::                                                                                                                        '
! !