compiler/benchmarks/PPCBenchmark.st
changeset 520 9ccc84deaea0
parent 516 3b81c9e53352
child 525 751532c8f3db
--- a/compiler/benchmarks/PPCBenchmark.st	Tue Aug 18 13:09:42 2015 +0100
+++ b/compiler/benchmarks/PPCBenchmark.st	Tue Aug 18 16:57:08 2015 +0100
@@ -35,18 +35,27 @@
     "
 !
 
-run: selector
-    | benchmarkSuiteClass |
+run: selectorOrSelectors
+    | benchmarkSuiteClass benchmarkSuite |
     
     benchmarkSuiteClass := Smalltalk at: #BenchmarkSuite.
     benchmarkSuiteClass isNil ifTrue:[
         self error: 'CalipeL is not loaded.'
     ].
-    ^ (benchmarkSuiteClass  class:self selector: selector ) run
-    
+    selectorOrSelectors isSymbol ifTrue:[ 
+        benchmarkSuite := (benchmarkSuiteClass  class:self selector: selectorOrSelectors ) run
+    ] ifFalse:[ 
+        benchmarkSuite := benchmarkSuiteClass new.
+        selectorOrSelectors do:[:each | 
+            benchmarkSuite addBenchmark: (BenchmarkInstance class: self selector: each)   
+        ].
+    ].
+    ^ benchmarkSuite run
     "
     PPCBenchmark run: #benchmarkRBParserC
     "
+
+    "Modified: / 18-08-2015 / 16:34:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 spy: benchmark
@@ -359,6 +368,40 @@
     
 !
 
+benchmarkLRPParserC
+    <setup: #setupLRPParser>
+    <benchmark: 'LRP Parser - Standard'>
+
+    1000 timesRepeat:[ 
+        input do: [ :source | parser parse: source withContext: context ]
+    ]
+
+    "Created: / 18-08-2015 / 16:27:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+benchmarkLRPParserCompiledC
+    <setup: #setupLRPParserCompiled>
+    <teardown: #teardownLRPParserCompiled>
+    <benchmark: 'LRP Parser - Compiled'>
+    
+    1000 timesRepeat:[ 
+        input do: [ :source | parser parse: source withContext: context ]
+    ]
+
+    "Created: / 18-08-2015 / 16:26:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+benchmarkLRPParser_johanfabry_39C
+    <setup: #setupLRPParser>
+    <benchmark: 'LRP Parser - Standard johanfabry.39'>
+
+    1000 timesRepeat:[ 
+        input do: [ :source | parser parse: source withContext: context ]
+    ]
+
+    "Created: / 18-08-2015 / 16:49:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 benchmarkRBParserC
     <setup: #setupRBParser>
     <benchmark: 'RB Smalltalk Parser'>
@@ -576,6 +619,37 @@
     input := sources expressionSourcesBig.
 !
 
+setupLRPParser
+    
+    parser := PPCLRPParser new.
+    context := self context.
+    context initializeFor: parser.
+    input := PPCLRPSourcesResource current sources
+
+    "Created: / 18-08-2015 / 16:34:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setupLRPParserCompiled
+
+    configuration := PPCConfiguration universal.
+    parser := PPCLRPParser new compileWithConfiguration: configuration.
+    context := self context.
+    context initializeFor: parser.
+    input := PPCLRPSourcesResource current sources
+
+    "Created: / 18-08-2015 / 16:35:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setupLRPParser_johanfabry_39     
+    
+    parser := PPCLRPParser_johanfabry_39 new.
+    context := self context.
+    context initializeFor: parser.
+    input := PPCLRPSourcesResource current sources
+
+    "Created: / 18-08-2015 / 16:48:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 setupRBParser
     
     input := sources smalltalkSourcesBig.
@@ -685,6 +759,17 @@
 "
 !
 
+teardownLRPParserCompiled
+    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: / 18-08-2015 / 16:36:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 teardownSmalltalkGrammarCompiled
     parser class removeFromSystem.
 "