--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/s/benchmarks/stx/BenchmarkSpeedTester.st Mon Mar 10 11:40:06 2014 +0000
@@ -0,0 +1,606 @@
+"{ Package: 'jv:calipel/s/benchmarks/stx' }"
+
+Object subclass:#BenchmarkSpeedTester
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'CalipeL-S-Benchmarks-St/X'
+!
+
+!BenchmarkSpeedTester class methodsFor:'documentation'!
+
+history
+
+ "Created: / 12.11.1997 / 17:16:01 / cg"
+ "Created: #allocSpeedTest / 12.11.1997 / 17:17:26 / cg"
+ "Created: #integerMathSpeedTest / 12.11.1997 / 17:22:58 / cg"
+ "Created: #floatMathSpeedTest / 12.11.1997 / 17:23:55 / cg"
+ "Created: #stringCompareSpeedTest / 12.11.1997 / 17:26:11 / cg"
+ "Created: #arrayWriteSpeedTest / 12.11.1997 / 17:27:59 / cg"
+ "Created: #dictionaryWriteSpeedTest / 12.11.1997 / 17:31:41 / cg"
+ "Modified: #dictionaryWriteSpeedTest / 12.11.1997 / 17:32:18 / cg"
+ "Created: #orderedCollectionWriteSpeedTest / 12.11.1997 / 17:34:01 / cg"
+ "Created: #orderedCollectionIterateSpeedTest / 12.11.1997 / 17:35:53 / cg"
+ "Modified: #integerMathSpeedTest / 13.11.1997 / 17:06:21 / cg"
+ "Modified: #integerMathSpeedTest / 13.11.1997 / 17:11:41 / cg"
+ "Modified: #results / 30.7.1998 / 11:14:24 / cg"
+!
+
+results
+"
+ #(
+ ('alloc ........:' #allocSpeedTest)
+ ('arrayWrite ...:' #arrayWriteSpeedTest)
+ ('ordCollWrite .:' #orderedCollectionWriteSpeedTest)
+ ('ordCollIterate:' #orderedCollectionIterateSpeedTest)
+ ('dictWrite ....:' #dictionaryWriteSpeedTest)
+ ('integerMath ..:' #integerMathSpeedTest)
+ ('floatMath ....:' #floatMathSpeedTest)
+ ('stringCompare :' #stringCompareSpeedTest)
+ ) do:[:pair |
+ |title test|
+
+ title := pair at:1.
+ test := pair at:2.
+
+ Transcript show:(title);endEntry.
+ 5 timesRepeat:[
+ Transcript show:((SpeedTester new perform:test) printStringLeftPaddedTo:7);endEntry.
+ Transcript space.
+ ].
+ Transcript cr;endEntry.
+ ].
+
+
+
+
+ | alloc | arrayWrite | ordCollWrite | ordCollIterate | dictWrite | integerMath | floatMath | stringCompare |
+times |100000 | 100000 | 100000 | 100000 | 10000 | 300000 | 300000 | 100000 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+NO JIT
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ alpha433 osf1 | 999 | 363 | 870 | 1166 | 250 | 3680 | 4424 | 359 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ hp B2000 cc | 1625 | 440 | 979 | 2739 | 257 | 3676 | 4982 | 537 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P6/266 lx-ELF/pgcc| 1309 | 789 | 1171 | 1513 | 263 | 4702 | 7109 | 792 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P5/200 linux-ELF | | | | | | | | |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P5/133 linux-aout | 2961 | 1088 | 2225 | 3455 | 586 | 6986 | 14264 | 1146 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ indy/200 irix5.3 | 3837 | 1261 | 3274 | 4262 | 822 | 8158 | 16010 | 1501 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ hp735/100 10.20/gc| 5909 | 1277 | 3906 | 9984 | 1165 | 8977 | 18630 | 1712 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ ss10/40 sol2.5 | 6240 | 2880 | 5837 | 10323 | 1654 | 20372 | 32018 | 3036 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ alpha233 osf1 | 7649(2) | 1332 | 5711(2) | 6981 | 2039(2) | 18752 | 42058(2)| 1245 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ 486/50 linux-ELF | | | | | | | | |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ 320H aix3.2.5/gcc | 18230 | 8659 | 20991 | 28303 | 6430 | 65679 | 90023 | 9946 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ | alloc | arrayWrite | ordCollWrite | ordCollIterate | dictWrite | integerMath | floatMath | stringCompare |
+
+
+WITH JIT
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P6/400 lx-ELF/egcs| 434 | 119 | 335 | 581 | 109 | 691 | 2977 | 94 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ alpha433 osf1 | 549 | 159 | 559 | 862 | 187 | 876 | 2993 | 92 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ ultra/250 sol2.6 | 599 | 141 | 604 | 1429 | 242 | 1502 | 3234 | 111 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P6/266 lx-ELF/gcc | 610 | 199 | 483 | 843 | 170 | 1068 | 4071 | 128 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P6/266 lx-ELF/pgcc| 631 | 183 | 494 | 856 | 171 | 1068 | 4208 | 138 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P5/200 linux-ELF | 1475(3) | 330 | 951 | 1610 | 296 | 2088 | 7935(3)| 209 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P5/200Nlinux-ELF | 2142(3) | 331 | 1065 | 1582 | 323 | 2042 | 9974(3)| 215 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P5/200N W95 | 2625(3) | 369 | 1593 | 2114 | 506 | 3462 | 11142(3)| 178 |
+ | | | | 1978 | 496 | 2253 | 10439 | |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P5/150 linux-ELF | 1520 | 297 | 970 | 1770 | 370 | 1962 | 7995 | 179 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ P5/133 linux-aout | 1669 | 422 | 1171 | 2401 | 405 | 2853 | 9470 | 241 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ indy/200 irix5.3 | 2160 | 521 | 1656 | 2847 | 612 | 5626 | 16653(1)| 316 |
+ | 1936 | 543 | 1844 | 2962 | 614 | 5458 | 11112(1)| 318 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ ss10/40 sol2.5 | 4099 | 1201 | 3622 | 8192 | 1381 | 16873 | 22720 | 813 |
+ | 4031 | | | 8032 | 1319 | | 22537 | 807 |
+ | 4360 | 1189 | 3965 | 7724 | 1428 | 9627 | 21192 | 891 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ alpha233 osf1 | 6373(2) | 513 | 4079(2) | 3799 | 1334(2) | 3910 | 34703(2)| 226 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ 486/50 linux-ELF | 6472 | 2192 | 5505 | 11541 | 2082 | 12985 | 47204 | 1394 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ 320H aix3.2.5 | 9876 | 3208 | 11787 | 19300 | 3815 | 27664 | 67262 | 2194 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ 68k/33Mhz next3.3 | 9936 | 3468 | 9164 | 17808 | 3496 | 59377 | 101936 | 2339 |
+-------------------+----------+------------+--------------+----------------+-----------+-------------+-----------+---------------+
+ | alloc | arrayWrite | ordCollWrite | ordCollIterate | dictWrite | integerMath | floatMath | stringCompare |
+
+ Notice:
+ (1) mips JIT does send for float arithmetic; bytecode interpreter does it inline.
+ (2) the alpha is running 64 bit code (shuffling around twice as much data)
+ the 233 alpha tested had NO cache (actually, a totally useless configuration)
+ (3) the P5/200N used in the test was a notebook (lion) with a poor memory HW-interface;
+ (results in memory-intensive menchmarks being slower than on a P5/133)
+ the faster machine has the same CPU, but a much better memory interface.
+"
+! !
+
+!BenchmarkSpeedTester methodsFor:'tests'!
+
+allocSpeedTest
+ ObjectMemory markAndSweep.
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ Array new:10;
+ new:10;
+ new:10;
+ new:10;
+ new:10;
+ new:10;
+ new:10;
+ new:10;
+ new:10;
+ new:10
+ ].
+ ObjectMemory markAndSweep.
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:SpeedTester new allocSpeedTest;endEntry
+ ]
+ "
+
+ "Created: / 12.11.1997 / 17:17:26 / cg"
+ "Modified: / 19.4.1999 / 14:44:53 / cg"
+!
+
+arrayReadSpeedTest
+ |array junk|
+
+ junk := Object new.
+ array := Array new:10.
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ array at:1;
+ at:2;
+ at:3;
+ at:4;
+ at:5;
+ at:6;
+ at:7;
+ at:8;
+ at:9;
+ at:10
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:SpeedTester new arrayReadSpeedTest;endEntry
+ ]
+ "
+
+ "Modified: / 12.11.1997 / 18:09:04 / cg"
+ "Created: / 7.5.1998 / 15:02:55 / cg"
+!
+
+arrayWriteSpeedTest
+ |array junk|
+
+ junk := Object new.
+ array := Array new:10.
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ array at:1 put:junk;
+ at:2 put:junk;
+ at:3 put:junk;
+ at:4 put:junk;
+ at:5 put:junk;
+ at:6 put:junk;
+ at:7 put:junk;
+ at:8 put:junk;
+ at:9 put:junk;
+ at:10 put:junk
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:SpeedTester new arrayWriteSpeedTest;endEntry
+ ]
+ "
+
+ "Created: / 12.11.1997 / 17:27:59 / cg"
+ "Modified: / 12.11.1997 / 18:09:04 / cg"
+!
+
+dictionaryReadSpeedTest
+ |dict junk key1 key2 key3 key4 key5 key6 key7 key8 key9 key10|
+
+ junk := Object new.
+ key1 := Object new.
+ key2 := Object new.
+ key3 := Object new.
+ key4 := Object new.
+ key5 := Object new.
+ key6 := Object new.
+ key7 := Object new.
+ key8 := Object new.
+ key9 := Object new.
+ key10 := Object new.
+
+ dict := IdentityDictionary new.
+ dict at:key1 put:junk;
+ at:key2 put:junk;
+ at:key3 put:junk;
+ at:key4 put:junk;
+ at:key5 put:junk;
+ at:key6 put:junk;
+ at:key7 put:junk;
+ at:key8 put:junk;
+ at:key9 put:junk;
+ at:key10 put:junk.
+
+ ^ Time millisecondsToRun:[
+ 10000 timesRepeat:[
+ dict at:key1;
+ at:key2;
+ at:key3;
+ at:key4;
+ at:key5;
+ at:key6;
+ at:key7;
+ at:key8;
+ at:key9;
+ at:key10
+ ].
+ ].
+
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:(SpeedTester new dictionaryReadSpeedTest); endEntry
+ ]
+ "
+
+ "Created: / 7.5.1998 / 15:10:31 / cg"
+ "Modified: / 7.5.1998 / 15:16:47 / cg"
+!
+
+dictionaryWriteSpeedTest
+ |dict junk key1 key2 key3 key4 key5 key6 key7 key8 key9 key10|
+
+ junk := Object new.
+ key1 := Object new.
+ key2 := Object new.
+ key3 := Object new.
+ key4 := Object new.
+ key5 := Object new.
+ key6 := Object new.
+ key7 := Object new.
+ key8 := Object new.
+ key9 := Object new.
+ key10 := Object new.
+
+ ^ Time millisecondsToRun:[
+ 10000 timesRepeat:[
+ dict := IdentityDictionary new.
+ dict at:key1 put:junk;
+ at:key2 put:junk;
+ at:key3 put:junk;
+ at:key4 put:junk;
+ at:key5 put:junk;
+ at:key6 put:junk;
+ at:key7 put:junk;
+ at:key8 put:junk;
+ at:key9 put:junk;
+ at:key10 put:junk
+ ].
+ ].
+
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:(SpeedTester new dictionaryWriteSpeedTest); endEntry
+ ]
+ "
+
+ "Created: / 12.11.1997 / 17:31:41 / cg"
+ "Modified: / 7.5.1998 / 14:23:24 / cg"
+!
+
+floatMathSpeedTest
+ |a b c d e|
+
+ a := 87.0.
+ b := 53.0.
+ c := -87.0.
+ d := 42461.0.
+ e := 5.0.
+ ^ Time millisecondsToRun:[
+ 300000 timesRepeat:[
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:SpeedTester new floatMathSpeedTest;endEntry
+ ]
+ "
+
+ "Created: / 12.11.1997 / 17:23:55 / cg"
+!
+
+integerMathSpeedTest
+ |a b c d e|
+
+ a := 87.
+ b := 53.
+ c := -87.
+ d := 42461.
+ e := 5.
+ ^ Time millisecondsToRun:[
+ 300000 timesRepeat:[
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ e := (e * a + b) * c + d.
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:SpeedTester new integerMathSpeedTest;endEntry
+ ]
+ "
+
+ "Created: / 12.11.1997 / 17:22:58 / cg"
+ "Modified: / 13.11.1997 / 17:11:41 / cg"
+!
+
+orderedCollectionIterateSpeedTest
+ |oc junk|
+
+ junk := Object new.
+ oc := OrderedCollection new:20.
+ oc addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk.
+
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ oc do:[:element | ].
+ oc do:[:element | ].
+ oc do:[:element | ].
+ oc do:[:element | ].
+ oc do:[:element | ].
+ oc do:[:element | ].
+ oc do:[:element | ].
+ oc do:[:element | ].
+ oc do:[:element | ].
+ oc do:[:element | ].
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:(SpeedTester new orderedCollectionIterateSpeedTest);endEntry
+ ]
+ "
+
+ "Created: / 12.11.1997 / 17:35:53 / cg"
+ "Modified: / 12.11.1997 / 17:41:50 / cg"
+!
+
+orderedCollectionReadSpeedTest
+ |oc junk|
+
+ junk := Object new.
+ oc := OrderedCollection new:20.
+ oc addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk.
+
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ oc at:1;
+ at:2;
+ at:3;
+ at:4;
+ at:5;
+ at:6;
+ at:7;
+ at:8;
+ at:9;
+ at:10
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:(SpeedTester new orderedCollectionReadSpeedTest); endEntry
+ ]
+ "
+
+ "Modified: / 12.11.1997 / 17:44:58 / cg"
+ "Created: / 7.5.1998 / 15:11:21 / cg"
+!
+
+orderedCollectionWriteSpeedTest
+ |oc junk|
+
+ junk := Object new.
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ oc := OrderedCollection new:20.
+ oc addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk;
+ addLast:junk
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:(SpeedTester new orderedCollectionWriteSpeedTest); endEntry
+ ]
+ "
+
+ "Created: / 12.11.1997 / 17:34:01 / cg"
+ "Modified: / 12.11.1997 / 17:44:58 / cg"
+!
+
+stringCompareSpeedTest
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long strings'.
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:SpeedTester new stringCompareSpeedTest;endEntry
+ ]
+ "
+
+ "Created: / 12.11.1997 / 17:26:11 / cg"
+ "Modified: / 12.11.1997 / 18:47:32 / cg"
+!
+
+stringCompareSpeedTest2
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'Xthis is a test of a compare of two long stringsX'.
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:SpeedTester new stringCompareSpeedTest2;endEntry
+ ]
+ "
+
+ "Modified: / 12.11.1997 / 18:47:32 / cg"
+ "Created: / 7.5.1998 / 14:32:59 / cg"
+!
+
+stringCompareSpeedTest3
+ ^ Time millisecondsToRun:[
+ 100000 timesRepeat:[
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ 'this is a test of a compare of two long strings'
+ = 'this is a test of a compare of two long stringsX'.
+ ]
+ ]
+
+ "
+ 5 timesRepeat:[
+ Transcript showCR:SpeedTester new stringCompareSpeedTest3;endEntry
+ ]
+ "
+
+ "Modified: / 12.11.1997 / 18:47:32 / cg"
+ "Created: / 7.5.1998 / 14:32:41 / cg"
+! !
+