Integer.st
changeset 19164 16e88ae992a1
parent 19163 b45df3976f74
child 19167 699eef1bc815
child 19231 89380e45244b
--- a/Integer.st	Wed Feb 10 03:01:06 2016 +0100
+++ b/Integer.st	Wed Feb 10 03:02:30 2016 +0100
@@ -3071,6 +3071,57 @@
      Time millisecondsToRun:[10000 factorial]40
      Time millisecondsToRun:[100000 factorial]3220
      Time millisecondsToRun:[1000000 factorial]357120
+
+    #(factorialIter factorialHalf factorialEvenOdd factorial)
+    do:[:sel |
+      #( (10000 10) 
+         (20000 10)
+         (50000 10)
+         (70000 10)
+         (100000 5)
+         (200000 3)
+         (300000 3)
+         (400000 3)) pairsDo:[:n :repeat |
+         |times|
+        times := (1 to:repeat) collect:[:i |
+                Time millisecondsToRun:[ n perform:sel]
+               ].
+
+        Transcript printf:'%12s %6d: %5d\n' with:sel with:n with:times min 
+      ]
+    ].
+
+    factorialIter  10000:    30
+    factorialIter  20000:   130
+    factorialIter  50000:   790
+    factorialIter  70000:  1710
+    factorialIter 100000:  4880
+    factorialIter 200000: 24980
+    factorialIter 300000: 60060
+    factorialIter 400000: 112310
+    factorialHalf  10000:    20
+    factorialHalf  20000:   100
+    factorialHalf  50000:   690
+    factorialHalf  70000:  1430
+    factorialHalf 100000:  3220
+    factorialHalf 200000: 28340
+    factorialHalf 300000: 68740
+    factorialHalf 400000: 127490
+    factorialEvenOdd  10000:    10
+    factorialEvenOdd  20000:    60
+    factorialEvenOdd  50000:   390
+    factorialEvenOdd  70000:   810
+    factorialEvenOdd 100000:  2020
+    factorialEvenOdd 200000:  9960
+    factorialEvenOdd 300000: 24480
+    factorialEvenOdd 400000: 45340
+    factorial  10000:    20
+    factorial  20000:   100
+    factorial  50000:   680
+    factorial  70000:  1400
+    factorial 100000:  2040
+    factorial 200000: 10130
+    factorial 300000: 24670
     "
 !