"{ Package: 'stx:libjava/experiments' }"
TestCase subclass:#PerformanceTests
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Tests'
!
!PerformanceTests methodsFor:'testing'!
_testPerformance
| objectCount objects loops mc jmc time |
"Not real Test, just brief overview of performance
Measure time of method invocation
- without parameter on ST object
- with Java object as a parameter on ST object
- without parameter on Java object
- with Java object as a parameter on Java object
See transcript for results
"
objectCount := 100.
objects := OrderedCollection new.
loops := 100000.
mc := PerformanceTestStObject new.
jmc := (Java classForName:'PerformanceTestObject') new.
objectCount timesRepeat: [
objects add: Object new.
].
time := Time millisecondsToRun: [
loops timesRepeat:[
mc repeat: objects atRandom.
]
].
Transcript showCR: 'st time with object: ', time asString, 'ms'.
time := Time millisecondsToRun: [
loops timesRepeat:[
objects atRandom.
mc foo.
]
].
Transcript showCR: 'st time no parameter: ', time asString, 'ms'.
time := Time millisecondsToRun: [
loops timesRepeat:[
jmc repeat: objects atRandom.
]
].
Transcript showCR: 'Java time with object: ', time asString, 'ms'.
time := Time millisecondsToRun: [
loops timesRepeat:[
objects atRandom.
jmc foo.
]
].
Transcript showCR: 'Java time no parameter: ', time asString, 'ms'.
"Modified: / 09-01-2011 / 21:58:53 / Jan Kurs <kurs.jan@post.cz>"
"Created: / 17-02-2011 / 16:23:38 / kursjan <kursjan@fit.cvut.cz>"
"Modified: / 21-02-2011 / 11:08:05 / kursjan <kursjan@fit.cvut.cz>"
! !
!PerformanceTests class methodsFor:'documentation'!
version_SVN
^ '$Id$'
! !