--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/micro/BenchmarkMicro.st Tue Jun 11 01:32:00 2013 +0100
@@ -0,0 +1,117 @@
+"{ Package: 'jv:calipel/s/benchmarks/micro' }"
+
+Object subclass:#BenchmarkMicro
+ instanceVariableNames:'iterations stream hello table ary1 ary2'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'CalipeL-S-Benchmarks-Micro'
+!
+
+
+!BenchmarkMicro class methodsFor:'running'!
+
+run
+ ^ (BenchmarkSuite class:self) run
+
+ "Created: / 10-06-2013 / 21:53:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+run: benchmark
+ ^ (BenchmarkInstance class:self selector:benchmark) run
+
+ "Created: / 31-05-2013 / 10:39:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-06-2013 / 21:53:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BenchmarkMicro methodsFor:'benchmarks'!
+
+ackermann
+ <benchmark>
+
+ self ackermann: 3 with: 8
+
+ "Created: / 11-06-2013 / 01:29:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+ackermann: x with: y
+ ^x = 0
+ ifTrue: [y + 1]
+ ifFalse: [
+ y = 0
+ ifTrue: [x - 1 ackermann: 1]
+ ifFalse: [x - 1 ackermann: (self ackermann: x with: y - 1)] ]
+
+ "Created: / 11-06-2013 / 01:29:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+ary
+ <benchmark>
+
+ | n |
+
+ n := ary1 size.
+ 1 to: 1000 do: [:ignored|
+ n to: 1 by: -1 do: [:i| ary2 at: i put: (ary2 at: i) + (ary1 at: i)] ].
+
+ "Created: / 11-06-2013 / 01:25:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hsh
+ <benchmark>
+
+ | n count |
+
+ n := iterations * 10.
+ count := 0.
+
+ 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
+ ]
+ ].
+
+ "Created: / 11-06-2013 / 01:21:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+strcat
+ <benchmark>
+
+ 1 to: (iterations * 5000) do: [:idx|
+ stream nextPutAll:hello
+ ].
+
+ "Created: / 28-05-2013 / 00:49:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-06-2013 / 01:12:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BenchmarkMicro methodsFor:'running'!
+
+setUp
+ <setup>
+
+ stream := WriteStream on:String new.
+ hello := 'hello' , Character cr asString.
+ iterations := iterations ? 1000.
+ table := Dictionary new: (iterations * 10) + ((iterations * 10) // 5).
+ ary1 := (1 to:iterations * 100) asArray.
+ ary2 := Array new:iterations * 100 withAll: 0.
+
+ "Created: / 28-05-2013 / 00:50:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-06-2013 / 01:25:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BenchmarkMicro class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+!
+
+version_MC
+ ^ 'CalipeL_S-Benchmarks-JanVrany.1 b5f61090-c9d7-11e2-a959-606720e43e2c 2013-05-31T10:51:48 JanVrany'
+! !
+