- JavaBenchmark
added:
#runBenchmarkS:
#runJ:
#runS:
comment/format in: #runBenchmarkJ:
- Strcat
added: #runBenchmarkS:
- Groovy
added: #runBenchmarkS:
- Ackerman
added: #runBenchmarkS:
- OverloadedMethods
added: #runBenchmarkS:
- Ary
added: #runBenchmarkS:
- MethodInvocation
added: #runBenchmarkS:
- OverloadedMethods2
added: #runBenchmarkS:
- Hash
added: #runBenchmarkS:
- JavaBenchmarkRunner
added:13 methods
- Saxon
added: #runBenchmarkS:
- Threadring
added:
#runBenchmarkS:
#threadRing:
- CrossLanguageInvocation
added: #runBenchmarkS:
- stx_libjava_benchmarks
added:
#extensionsVersion_SVN
#javaClassPath
#javaSourcePath
changed:
#classNamesAndAttributes
#extensionMethodNames
#preRequisites
- extensions
...
--- a/src/benchmarks/Ackerman.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Ackerman.st Wed Oct 31 11:16:49 2012 +0000
@@ -10,12 +10,9 @@
!Ackerman methodsFor:'running'!
-runBenchmark: n
- 3 ackermann: n.
- ^ Time millisecondsToRun: [
- 3 ackermann: n
- ].
-
+runBenchmarkS:n
+ 3 ackermann:n.
+ ^ Time millisecondsToRun:[ 3 ackermann:n ].
! !
!Ackerman class methodsFor:'documentation'!
--- a/src/benchmarks/Ary.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Ary.st Wed Oct 31 11:16:49 2012 +0000
@@ -15,11 +15,18 @@
n to: 1 by: -1 do: [:i| y at: i put: (y at: i) + (x at: i)] ].
!
-runBenchmark: n
- | x y |
- x := (1 to: n) asArray.
- y := Array new: n withAll: 0.
- ^Time millisecondsToRun: [self runAryTest: x with: y with: n].
+runBenchmarkS:n
+ | x y |
+
+ x := (1 to:n) asArray.
+ y := Array new:n withAll:0.
+ ^ Time
+ millisecondsToRun:[
+ self
+ runAryTest:x
+ with:y
+ with:n
+ ].
! !
!Ary class methodsFor:'documentation'!
--- a/src/benchmarks/CrossLanguageInvocation.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/CrossLanguageInvocation.st Wed Oct 31 11:16:49 2012 +0000
@@ -14,15 +14,6 @@
^self
!
-runBenchmark: n
- | inst |
- inst := Object new.
- n timesRepeat: [ inst doSmth ].
- ^ Time millisecondsToRun: [
- n timesRepeat: [ inst doSmth ]
- ].
-!
-
runBenchmarkJ: n
| inst |
inst := JAVA CrossLangInvocation new.
@@ -34,6 +25,19 @@
]
"Created: / 31-10-2012 / 10:16:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+runBenchmarkS:n
+ | inst |
+
+ inst := Object new.
+ n timesRepeat:[
+ inst doSmth
+ ].
+ ^ Time
+ millisecondsToRun:[ n timesRepeat:[
+ inst doSmth
+ ] ].
! !
!CrossLanguageInvocation class methodsFor:'documentation'!
--- a/src/benchmarks/Groovy.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Groovy.st Wed Oct 31 11:16:49 2012 +0000
@@ -10,7 +10,7 @@
!Groovy methodsFor:'running'!
-runBenchmark: n
+runBenchmarkS:n
^ 'N/A'
"Created: / 31-10-2012 / 10:17:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
--- a/src/benchmarks/Hash.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Hash.st Wed Oct 31 11:16:49 2012 +0000
@@ -10,17 +10,22 @@
!Hash methodsFor:'running'!
-runBenchmark: n
- | count table |
- count := 0.
- table := Dictionary new: n + (n // 5).
+runBenchmarkS:n
+ | count table |
- ^ 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]
- ].
- ].
+ 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'!
--- a/src/benchmarks/JavaBenchmark.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/JavaBenchmark.st Wed Oct 31 11:16:49 2012 +0000
@@ -55,17 +55,8 @@
!JavaBenchmark methodsFor:'running'!
-runBenchmark: n
- "Run a **Smalltalk** benchmark. Return time in milliseconds or
- string 'N/A' if there is no Smalltalk equivalent of the benchmark"
-
- ^self subclassResponsibility
-
- "Created: / 31-10-2012 / 10:26:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
runBenchmarkJ: n
- "Run a **Java** benchmark. Return time in milliseconds or
+ "Actually run a **Java** benchmark. Return time in milliseconds or
string 'N/A' if there is no Java equivalent of the benchmark"
| bench |
@@ -74,6 +65,59 @@
^bench perform: #'runBenchmark(I)L'
"Created: / 31-10-2012 / 10:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+runBenchmarkS:n
+ "Actually run a **Smalltalk** benchmark. Return time in milliseconds or
+ string 'N/A' if there is no Smalltalk equivalent of the benchmark"
+
+ ^ self subclassResponsibility
+
+ "Created: / 31-10-2012 / 10:26:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaBenchmark methodsFor:'running-API'!
+
+runJ: passes
+ "Run **Smalltalk** version of the benchmark. Do the warmup"
+
+ "Here, we have to do the warmup twice. First, to
+ load all the Java code and an make sure methods
+ are in oldspace (for ILCs), second to force resolve
+ and machine-compile Java code"
+
+ JavaVM booted ifFalse:[
+
+ "Set stack size to 16MB"
+ Process defaultMaximumStackSize: ((1024 * 1024 * 160) max: Process defaultMaximumStackSize).
+
+ "Setup for performance"
+ JavaNativeMethod cacheNativeImplementation: true.
+ ObjectMemory justInTimeCompilation: true.
+ ObjectMemory javaNativeCodeOptimization:true.
+ ObjectMemory javaJustInTimeCompilation: true.
+
+ Java flushAllJavaResources.
+ Java initialize.
+ JavaVM initializeVM.
+ ].
+
+ self runBenchmarkJ: passes.
+ ObjectMemory scavenge.
+ ObjectMemory tenure.
+ self runBenchmarkJ: passes.
+
+ "Created: / 31-10-2012 / 11:15:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+runS: passes
+ "Run **Smalltalk** version of the benchmark. Do the warmup"
+
+ ObjectMemory scavenge.
+ ObjectMemory tenure.
+ self runBenchmarkS: passes.
+
+ "Created: / 31-10-2012 / 11:12:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaBenchmark class methodsFor:'documentation'!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/benchmarks/JavaBenchmarkRunner.st Wed Oct 31 11:16:49 2012 +0000
@@ -0,0 +1,212 @@
+"{ Package: 'stx:libjava/benchmarks' }"
+
+StandaloneStartup subclass:#JavaBenchmarkRunner
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Benchmarks-Java-Framework'
+!
+
+JavaBenchmarkRunner class instanceVariableNames:'benchmark passes runJava debugging'
+
+"
+ The following class instance variables are inherited by this class:
+
+ StandaloneStartup - MutexHandle
+ Object -
+"
+!
+
+
+!JavaBenchmarkRunner class methodsFor:'initialization'!
+
+initialize
+
+ super initialize.
+ debugging := Transcript notNil and:[Transcript isView].
+ runJava := true
+
+ "Created: / 06-11-2011 / 22:07:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 31-10-2012 / 11:02:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaBenchmarkRunner class methodsFor:'command line options'!
+
+cmdlineOptionBenchmark
+
+ ^CmdLineOption new
+ short: $b;
+ long: '--benchmark';
+ description: 'benchmark to run (class name)';
+ action:[:option |
+ benchmark := Smalltalk at: option asSymbol.
+ benchmark isNil ifTrue:[
+ Stderr nextPutLine: 'ERROR: No such benchmark: ', option.
+ Smalltalk exit: 0.
+ ]
+ ]
+
+ "Created: / 31-10-2012 / 10:49:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+cmdlineOptionJava
+
+ ^CmdLineOption new
+ short: $j;
+ long: '--java';
+ description: 'run Java version of the benchmark (default)';
+ action:[
+ runJava := true
+ ]
+
+ "Created: / 31-10-2012 / 11:03:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+cmdlineOptionPasses
+
+ ^CmdLineOption new
+ short: $n;
+ long: '--passed';
+ description: 'how many passes to run (integer)';
+ action:[:option |
+ passes := Integer readFrom: option onError:[
+ Stderr nextPutLine: 'ERROR: Not an integer value: ', option.
+ Smalltalk exit: 0.
+ ]
+ ]
+
+ "Created: / 31-10-2012 / 10:52:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+cmdlineOptionSmalltak
+
+ ^CmdLineOption new
+ short: $s;
+ long: '--smalltalk';
+ description: 'run Smalltalk version of the benchmark';
+ action:[
+ runJava := false
+ ]
+
+ "Created: / 31-10-2012 / 11:04:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaBenchmarkRunner class methodsFor:'defaults'!
+
+allowCoverageMeasurementOption
+
+ ^true
+
+ "Created: / 13-01-2012 / 11:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 31-10-2012 / 10:38:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+allowDebugOption
+
+ ^true
+
+ "Created: / 21-07-2011 / 09:48:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaBenchmarkRunner class methodsFor:'startup'!
+
+setupToolsForDebug
+
+ super setupToolsForDebug.
+ debugging := true.
+
+ "Created: / 06-11-2011 / 22:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+usage
+
+ Stderr nextPutLine:'usage:'; cr;
+ nextPutAll:' benchmark-runner.';
+ nextPutAll: (OperatingSystem isMSWINDOWSlike ifTrue:['bat'] ifFalse:['sh']);
+ nextPutAll: ' -b <benchmark> -n <n>'; cr; cr.
+
+ Stderr nextPutLine:' --help .................. output this message'.
+"/ Stderr nextPutLine:' --verbose ............... verbose startup'.
+"/ Stderr nextPutLine:' --noBanner .............. no splash screen'.
+"/ Stderr nextPutLine:' --newAppInstance ........ start as its own application process (do not reuse a running instance)'.
+"/ self allowScriptingOption ifTrue:[
+"/ Stderr nextPutLine:' --scripting portNr ...... enable scripting via port (or stdin/stdOut, if 0)'.
+"/ ].
+ self allowDebugOption ifTrue:[
+ Stderr nextPutLine:' --debug ................. enable Debugger'.
+ ].
+
+ "/ ' ......................... '
+ Stderr nextPutLine:' -b <benchmark>'.
+ Stderr nextPutLine:' --benchmark=<benchmark> . benchmark to run (class name)'.
+ Stderr nextPutLine:' -n <n>'.
+ Stderr nextPutLine:' --passes ................ how many passes of given benchmark (integer)'.
+ Stderr nextPutLine:' -j'.
+ Stderr nextPutLine:' --java ..,............... run Java version of the benchmark (default)'.
+ Stderr nextPutLine:' -s'.
+ Stderr nextPutLine:' --smalltalk ............. run Smalltalk version of the benchmark'.
+
+
+
+ "
+ self usage
+ "
+
+ "Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 31-10-2012 / 11:05:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaBenchmarkRunner class methodsFor:'startup-to be redefined'!
+
+main:argv
+
+ "Process command line arguments"
+ | parser |
+
+ parser := CmdLineParser new.
+ [
+ parser parse: argv for: self.
+ ] on: Error do:[:ex|
+ Stderr nextPutLine:'Error when processing options: ', ex description.
+ debugging ifFalse:[
+ ex suspendedContext fullPrintAllOn: Stderr.
+ Stderr nextPutLine:'Exiting'.
+ Smalltalk exit:1.
+ ] ifTrue:[
+ ex pass
+ ]
+ ].
+
+ [
+ | time |
+
+ time := runJava
+ ifTrue:[benchmark runJ: passes]
+ ifFalse:[benchmark runS: passes].
+
+ Stdout nextPutAll: 'EXECUTION TIME: ' , time printString.
+
+ debugging ifFalse:[
+ Smalltalk exit:0.
+ ].
+ ] on: Error do:[:ex|
+ Stderr nextPutAll:'Error when running benchmark: '.
+ Stderr nextPutAll:ex description; cr.
+ ex suspendedContext printAllOn:Stderr.
+ debugging ifFalse:[
+ Smalltalk exit:1.
+ ] ifTrue:[
+ ex pass
+ ]
+ ]
+
+ "Modified: / 31-10-2012 / 11:10:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaBenchmarkRunner class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id:: $'
+! !
+
+JavaBenchmarkRunner initialize!
--- a/src/benchmarks/Make.proto Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Make.proto Wed Oct 31 11:16:49 2012 +0000
@@ -34,7 +34,7 @@
# add the path(es) here:,
# ********** OPTIONAL: MODIFY the next lines ***
# LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libjava -I$(INCLUDE_TOP)/stx/libbasic
# if you need any additional defines for embedded C code,
@@ -107,6 +107,22 @@
prereq: $(REQUIRED_SUPPORT_DIRS)
cd ../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libdb/libodbc && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libcomp && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libdb && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libboss && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libdb/libsqlite && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libui && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libbasic3 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libwidg && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libhtml && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libwidg2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../libtool && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../librun && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
@@ -123,6 +139,7 @@
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
$(OUTDIR)JavaBenchmark.$(O) JavaBenchmark.$(H): JavaBenchmark.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaBenchmarkRunner.$(O) JavaBenchmarkRunner.$(H): JavaBenchmarkRunner.st $(INCLUDE_TOP)/stx/libbasic/StandaloneStartup.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)stx_libjava_benchmarks.$(O) stx_libjava_benchmarks.$(H): stx_libjava_benchmarks.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Ackerman.$(O) Ackerman.$(H): Ackerman.st $(INCLUDE_TOP)/stx/libjava/benchmarks/JavaBenchmark.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Ary.$(O) Ary.$(H): Ary.st $(INCLUDE_TOP)/stx/libjava/benchmarks/JavaBenchmark.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
@@ -135,6 +152,7 @@
$(OUTDIR)Saxon.$(O) Saxon.$(H): Saxon.st $(INCLUDE_TOP)/stx/libjava/benchmarks/JavaBenchmark.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Strcat.$(O) Strcat.$(H): Strcat.st $(INCLUDE_TOP)/stx/libjava/benchmarks/JavaBenchmark.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)Threadring.$(O) Threadring.$(H): Threadring.st $(INCLUDE_TOP)/stx/libjava/benchmarks/JavaBenchmark.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/SmallInteger.$(H) $(INCLUDE_TOP)/stx/libbasic/Integer.$(H) $(INCLUDE_TOP)/stx/libbasic/Number.$(H) $(INCLUDE_TOP)/stx/libbasic/ArithmeticValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Magnitude.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line
--- a/src/benchmarks/Make.spec Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Make.spec Wed Oct 31 11:16:49 2012 +0000
@@ -63,6 +63,7 @@
Strcat \
Threadring \
stx_libjava_benchmarks \
+ JavaBenchmarkRunner \
@@ -81,6 +82,8 @@
$(OUTDIR)Strcat.$(O) \
$(OUTDIR)Threadring.$(O) \
$(OUTDIR)stx_libjava_benchmarks.$(O) \
+ $(OUTDIR)JavaBenchmarkRunner.$(O) \
+ $(OUTDIR)extensions.$(O) \
--- a/src/benchmarks/MethodInvocation.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/MethodInvocation.st Wed Oct 31 11:16:49 2012 +0000
@@ -64,13 +64,17 @@
^self
!
-runBenchmark: n
- | inst |
- inst := Object new.
- n timesRepeat: [ inst doSmth ].
- ^ Time millisecondsToRun: [
- n timesRepeat: [ inst doSmth ]
- ].
+runBenchmarkS:n
+ | inst |
+
+ inst := Object new.
+ n timesRepeat:[
+ inst doSmth
+ ].
+ ^ Time
+ millisecondsToRun:[ n timesRepeat:[
+ inst doSmth
+ ] ].
! !
!MethodInvocation class methodsFor:'documentation'!
--- a/src/benchmarks/OverloadedMethods.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/OverloadedMethods.st Wed Oct 31 11:16:49 2012 +0000
@@ -25,20 +25,6 @@
!
-runBenchmark: n
- | inst |
- inst := Object new.
- ^ Time millisecondsToRun: [
- 1 to: n do:[:i|
- inst doSmth_i:0.
- inst doSmth_c:$c.
- inst doSmth_o:inst.
-
- ]
-
- ].
-!
-
runBenchmarkJ: n
| inst |
inst := JAVA OverloadedMethods new.
@@ -52,6 +38,20 @@
].
"Created: / 31-10-2012 / 10:19:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+runBenchmarkS:n
+ | inst |
+
+ inst := Object new.
+ ^ Time
+ millisecondsToRun:[
+ 1 to:n do:[:i |
+ inst doSmth_i:0.
+ inst doSmth_c:$c.
+ inst doSmth_o:inst.
+ ]
+ ].
! !
!OverloadedMethods class methodsFor:'documentation'!
--- a/src/benchmarks/OverloadedMethods2.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/OverloadedMethods2.st Wed Oct 31 11:16:49 2012 +0000
@@ -55,24 +55,6 @@
!
-runBenchmark: n
- | inst |
- inst := Object new.
- ^ Time millisecondsToRun: [
- 1 to: n do:[:idx|
- inst doSmth_1:0.
- inst doSmth_2:1.23345.
- inst doSmth_3:inst.
- inst doSmth_4: Object new.
- inst doSmth_5:''.
- inst doSmth_6:$c.
- inst doSmth_7:1.
- inst doSmth_8:1.
- inst doSmth_9:false.
- ].
- ].
-!
-
runBenchmarkJ: n
| inst o |
inst := JAVA OverloadedMethods2 new.
@@ -91,6 +73,26 @@
].
"Created: / 31-10-2012 / 10:20:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+runBenchmarkS:n
+ | inst |
+
+ inst := Object new.
+ ^ Time
+ millisecondsToRun:[
+ 1 to:n do:[:idx |
+ inst doSmth_1:0.
+ inst doSmth_2:1.23345.
+ inst doSmth_3:inst.
+ inst doSmth_4:Object new.
+ inst doSmth_5:''.
+ inst doSmth_6:$c.
+ inst doSmth_7:1.
+ inst doSmth_8:1.
+ inst doSmth_9:false.
+ ].
+ ].
! !
!OverloadedMethods2 class methodsFor:'documentation'!
--- a/src/benchmarks/Saxon.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Saxon.st Wed Oct 31 11:16:49 2012 +0000
@@ -10,7 +10,7 @@
!Saxon methodsFor:'running'!
-runBenchmark: n
+runBenchmarkS:n
^ 'N/A'
"Created: / 31-10-2012 / 10:21:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
--- a/src/benchmarks/Strcat.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Strcat.st Wed Oct 31 11:16:49 2012 +0000
@@ -10,14 +10,20 @@
!Strcat methodsFor:'running'!
-runBenchmark: n
- | stream hello |
- stream := WriteStream on: String new.
- hello := 'hello', Character cr asString.
- 10 timesRepeat: [stream nextPutAll: hello].
- ^ Time millisecondsToRun: [
- n timesRepeat: [stream nextPutAll: hello].
- ].
+runBenchmarkS:n
+ | stream hello |
+
+ stream := WriteStream on:String new.
+ hello := 'hello' , Character cr asString.
+ 10 timesRepeat:[
+ stream nextPutAll:hello
+ ].
+ ^ Time
+ millisecondsToRun:[
+ n timesRepeat:[
+ stream nextPutAll:hello
+ ].
+ ].
! !
!Strcat class methodsFor:'documentation'!
--- a/src/benchmarks/Threadring.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/Threadring.st Wed Oct 31 11:16:49 2012 +0000
@@ -15,10 +15,22 @@
!
+!Threadring methodsFor:'benchmarking'!
+
+threadRing: aSemaphore
+ | first last |
+ 503 to: 1 by: -1 do: [:i|
+ first := Thread named: i next: first done: aSemaphore.
+ last isNil ifTrue: [ last := first ].
+ ].
+ last nextThread: first.
+ ^first
+! !
+
!Threadring methodsFor:'running'!
-runBenchmark: n
- ^'N/A'
+runBenchmarkS:n
+ ^ 'N/A'
"Created: / 31-10-2012 / 10:22:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
--- a/src/benchmarks/abbrev.stc Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/abbrev.stc Wed Oct 31 11:16:49 2012 +0000
@@ -14,3 +14,4 @@
Strcat Strcat stx:libjava/benchmarks 'Benchmarks-Java-Micro' 0
Threadring Threadring stx:libjava/benchmarks 'Benchmarks-Java-Micro' 0
stx_libjava_benchmarks stx_libjava_benchmarks stx:libjava/benchmarks '* Projects & Packages *' 3
+JavaBenchmarkRunner JavaBenchmarkRunner stx:libjava/benchmarks 'Benchmarks-Java-Framework' 5
--- a/src/benchmarks/bc.mak Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/bc.mak Wed Oct 31 11:16:49 2012 +0000
@@ -34,7 +34,7 @@
-LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libjava -I$(INCLUDE_TOP)\stx\libbasic
LOCALDEFINES=
STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -varPrefix=$(LIBNAME)
@@ -51,6 +51,22 @@
# build all prerequisite packages for this package
prereq:
pushd ..\..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libdb\libodbc & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libcomp & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libdb & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libboss & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libdb\libsqlite & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libwidg & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libhtml & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libwidg2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libtool & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\librun & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
@@ -59,6 +75,7 @@
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
$(OUTDIR)JavaBenchmark.$(O) JavaBenchmark.$(H): JavaBenchmark.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaBenchmarkRunner.$(O) JavaBenchmarkRunner.$(H): JavaBenchmarkRunner.st $(INCLUDE_TOP)\stx\libbasic\StandaloneStartup.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)stx_libjava_benchmarks.$(O) stx_libjava_benchmarks.$(H): stx_libjava_benchmarks.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Ackerman.$(O) Ackerman.$(H): Ackerman.st $(INCLUDE_TOP)\stx\libjava\benchmarks\JavaBenchmark.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Ary.$(O) Ary.$(H): Ary.st $(INCLUDE_TOP)\stx\libjava\benchmarks\JavaBenchmark.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
@@ -71,5 +88,6 @@
$(OUTDIR)Saxon.$(O) Saxon.$(H): Saxon.st $(INCLUDE_TOP)\stx\libjava\benchmarks\JavaBenchmark.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Strcat.$(O) Strcat.$(H): Strcat.st $(INCLUDE_TOP)\stx\libjava\benchmarks\JavaBenchmark.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)Threadring.$(O) Threadring.$(H): Threadring.st $(INCLUDE_TOP)\stx\libjava\benchmarks\JavaBenchmark.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\SmallInteger.$(H) $(INCLUDE_TOP)\stx\libbasic\Integer.$(H) $(INCLUDE_TOP)\stx\libbasic\Number.$(H) $(INCLUDE_TOP)\stx\libbasic\ArithmeticValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Magnitude.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line
--- a/src/benchmarks/benchmarks.rc Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/benchmarks.rc Wed Oct 31 11:16:49 2012 +0000
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2012\nCopyright eXept Software AG 1998-2012\0"
VALUE "ProductName", "Smalltalk/X\0"
VALUE "ProductVersion", "6.2.3.1\0"
- VALUE "ProductDate", "Wed, 31 Oct 2012 10:33:49 GMT\0"
+ VALUE "ProductDate", "Wed, 31 Oct 2012 11:18:46 GMT\0"
END
END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/benchmarks/extensions.st Wed Oct 31 11:16:49 2012 +0000
@@ -0,0 +1,18 @@
+"{ Package: 'stx:libjava/benchmarks' }"!
+
+!SmallInteger methodsFor:'performance tests'!
+
+ackermann: anInteger
+ ^self = 0
+ ifTrue: [anInteger + 1]
+ ifFalse: [
+ anInteger = 0
+ ifTrue: [self - 1 ackermann: 1]
+ ifFalse: [self - 1 ackermann: (self ackermann: anInteger - 1)] ]
+! !
+
+!stx_libjava_benchmarks class methodsFor:'documentation'!
+
+extensionsVersion_SVN
+ ^ '$Id:: $'
+! !
\ No newline at end of file
--- a/src/benchmarks/libInit.cc Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/libInit.cc Wed Oct 31 11:16:49 2012 +0000
@@ -28,6 +28,7 @@
OBJ snd; struct __vmData__ *__pRT__; {
__BEGIN_PACKAGE2__("libstx_libjava_benchmarks", _libstx_libjava_benchmarks_Init, "stx:libjava/benchmarks");
_JavaBenchmark_Init(pass,__pRT__,snd);
+_JavaBenchmarkRunner_Init(pass,__pRT__,snd);
_stx_137libjava_137benchmarks_Init(pass,__pRT__,snd);
_Ackerman_Init(pass,__pRT__,snd);
_Ary_Init(pass,__pRT__,snd);
@@ -41,6 +42,6 @@
_Strcat_Init(pass,__pRT__,snd);
_Threadring_Init(pass,__pRT__,snd);
-
+_stx_137libjava_137benchmarks_extensions_Init(pass,__pRT__,snd);
__END_PACKAGE__();
}
--- a/src/benchmarks/stx_libjava_benchmarks.st Wed Oct 31 10:34:22 2012 +0000
+++ b/src/benchmarks/stx_libjava_benchmarks.st Wed Oct 31 11:16:49 2012 +0000
@@ -27,7 +27,8 @@
exclude individual packages in the #excludedFromPrerequisites method."
^ #(
- #'stx:libbasic' "LibraryDefinition - superclass of stx_libjava_benchmarks "
+ #'stx:libbasic' "StandaloneStartup - superclass of JavaBenchmarkRunner "
+ #'stx:libjava' "JavaVM - referenced by JavaBenchmark>>runJ: "
)
! !
@@ -54,9 +55,8 @@
Strcat
Threadring
#'stx_libjava_benchmarks'
+ JavaBenchmarkRunner
)
-
- "Modified: / 31-10-2012 / 10:32:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
extensionMethodNames
@@ -64,9 +64,35 @@
Entries are 2-element array literals, consisting of class-name and selector."
^ #(
+ SmallInteger ackermann:
)
! !
+!stx_libjava_benchmarks class methodsFor:'description - java'!
+
+javaClassPath
+
+ <javaclasspath>
+
+ ^{
+ self packageDirectory / 'java' / 'bin' .
+ self packageDirectory / 'java' / 'libs' / '*.jar'
+ }
+
+ "Created: / 17-11-2011 / 23:00:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaSourcePath
+
+ <javasourcepath>
+
+ ^{
+ self packageDirectory / 'java' / 'src' .
+ }
+
+ "Created: / 17-11-2011 / 23:01:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!stx_libjava_benchmarks class methodsFor:'description - project information'!
applicationIconFileName
@@ -122,7 +148,7 @@
"Return a SVN revision number of myself.
This number is updated after a commit"
- ^ "$SVN-Revision:"'nil '"$"
+ ^ "$SVN-Revision:"'2136 '"$"
! !
!stx_libjava_benchmarks class methodsFor:'documentation'!