compiler/benchmarks/PPCBenchmark.st
changeset 462 89464ab03518
parent 460 87a3d30ab570
child 465 f729f6cd3c76
--- a/compiler/benchmarks/PPCBenchmark.st	Tue May 12 01:57:37 2015 +0100
+++ b/compiler/benchmarks/PPCBenchmark.st	Sat May 16 19:21:00 2015 +0100
@@ -50,9 +50,17 @@
 !
 
 spy: benchmark
-    ^ (BenchmarkInstance class:self selector:benchmark) spy
+    | benchmarkInstanceClass |
+
+    benchmarkInstanceClass := Smalltalk at: #BenchmarkInstance.
+    benchmarkInstanceClass isNil ifTrue:[
+        self error: 'CalipeL is not loaded.'
+    ].   
+
+    ^ (benchmarkInstanceClass class:self selector:benchmark) spy
 
     "Created: / 11-05-2015 / 16:31:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-05-2015 / 19:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !PPCBenchmark methodsFor:'benchmark support'!
@@ -369,6 +377,26 @@
     input do: [ :source | parser parse: source withContext: context ]
 !
 
+benchmarkSmalltalkNoopParserCompiledC
+    <setup: #setupSmalltalkNoopParserCompiled>
+    <teardown: #teardownSmalltalkNoopParserCompiled>
+    <benchmark: 'Petit Smalltalk Parser (noop)- Compiled'>
+    
+    input do: [ :source | parser parse: source withContext: context ]
+
+    "Created: / 16-05-2015 / 09:45:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+benchmarkSmalltalkNoopParserTokenizedC
+    <setup: #setupSmalltalkNoopParserTokenized>
+    <teardown: #teardownSmalltalkNoopParserTokenized>
+    <benchmark: 'Petit Smalltalk Parser (noop) - Tokenized'>
+    
+    input do: [ :source | parser parse: source withContext: context ]
+
+    "Created: / 16-05-2015 / 09:46:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 benchmarkSmalltalkParserC
     <setup: #setupSmalltalkParser>
     <benchmark: 'Petit Smalltalk Parser - Standard'>
@@ -383,6 +411,16 @@
     
     input do: [ :source | parser parse: source withContext: context ]
     
+!
+
+benchmarkSmalltalkParserTokenizedC
+    <setup: #setupSmalltalkParserTokenized>
+    <teardown: #teardownSmalltalkParserTokenized>
+    <benchmark: 'Petit Smalltalk Parser - Tokenized'>
+    
+    input do: [ :source | parser parse: source withContext: context ]
+
+    "Created: / 16-05-2015 / 09:45:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !PPCBenchmark methodsFor:'intitialization'!
@@ -542,6 +580,28 @@
     input := sources smalltalkSourcesBig.
 !
 
+setupSmalltalkNoopParserCompiled
+
+    configuration := PPCConfiguration universal.
+    parser := PPCSmalltalkNoopParser new compileWithConfiguration: configuration.
+    context := PPCContext new.
+    context initializeFor: parser.
+    input := sources smalltalkSourcesBig.
+
+    "Created: / 16-05-2015 / 09:44:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setupSmalltalkNoopParserTokenized
+
+    configuration := PPCConfiguration LL1.
+    parser := PPCSmalltalkNoopParser new compileWithConfiguration: configuration.
+    context := PPCContext new.
+    context initializeFor: parser.
+    input := sources smalltalkSourcesBig.
+
+    "Created: / 16-05-2015 / 09:44:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 setupSmalltalkParser
     
     parser := PPSmalltalkParser new.
@@ -601,6 +661,28 @@
     "Created: / 11-05-2015 / 16:33:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+teardownSmalltalkNoopParserCompiled
+    parser class removeFromSystem.
+"       
+    size := input inject: 0 into: [:r :e | r + e size  ].
+    Transcript crShow: 'Compiled Grammar time: ', time asString.
+    Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'.
+"
+
+    "Created: / 16-05-2015 / 09:44:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+teardownSmalltalkNoopParserTokenized
+    parser class removeFromSystem.
+"       
+    size := input inject: 0 into: [:r :e | r + e size  ].
+    Transcript crShow: 'Compiled Grammar time: ', time asString.
+    Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'.
+"
+
+    "Created: / 16-05-2015 / 09:44:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 teardownSmalltalkParserCompiled
     parser class removeFromSystem.
 "	
@@ -608,6 +690,17 @@
     Transcript crShow: 'Compiled Grammar time: ', time asString.
     Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'.
 "
+!
+
+teardownSmalltalkParserTokenized
+    parser class removeFromSystem.
+"       
+    size := input inject: 0 into: [:r :e | r + e size  ].
+    Transcript crShow: 'Compiled Grammar time: ', time asString.
+    Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'.
+"
+
+    "Created: / 16-05-2015 / 09:47:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !PPCBenchmark class methodsFor:'documentation'!