--- a/compiler/benchmarks/PPCBenchmark.st Mon May 11 18:31:26 2015 +0100
+++ b/compiler/benchmarks/PPCBenchmark.st Tue May 12 01:33:33 2015 +0100
@@ -30,7 +30,7 @@
].
^ (benchmarkSuiteClass class:self) run
- "
+ "
PPCBenchmark run.
"
!
@@ -217,6 +217,68 @@
self reportInput: input time: time name: 'Smalltalk Parser Compiled'.
! !
+!PPCBenchmark methodsFor:'benchmarks - expression grammar'!
+
+benchmarkExpressionGrammar
+ | time |
+
+ self setupExpressionGrammar.
+
+ time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+
+ self reportInput: input time: time name: 'Expression Grammar'.
+!
+
+benchmarkExpressionGrammarCompiled
+ | time |
+
+ self setupExpressionGrammarCompiled.
+
+ time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+
+ self reportInput: input time: time name: 'Compiled Expression Grammar'.
+!
+
+benchmarkExpressionGrammarTokenized
+ | time |
+
+ self setupExpressionGrammarTokenized.
+
+ time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+
+ self reportInput: input time: time name: 'Tokenized Expression Grammar'.
+!
+
+benchmarkLL1ExpressionGrammar
+ | time |
+
+ self setupLL1ExpressionGrammar.
+
+ time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+
+ self reportInput: input time: time name: 'LL1 Expression Grammar'.
+!
+
+benchmarkLL1ExpressionGrammarCompiled
+ | time |
+
+ self setupLL1ExpressionGrammarCompiled.
+
+ time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+
+ self reportInput: input time: time name: 'Compiled LL1 Expression Grammar'.
+!
+
+benchmarkLL1ExpressionGrammarTokenized
+ | time |
+
+ self setupLL1ExpressionGrammarTokenized.
+
+ time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+
+ self reportInput: input time: time name: 'Tokenized LL1 Expression Grammar'.
+! !
+
!PPCBenchmark methodsFor:'benchmarks - micro'!
benchmarkAnyStar
@@ -243,6 +305,22 @@
!PPCBenchmark methodsFor:'benchmarks-CalipeL'!
+benchmarkExpressionGrammarC
+ <setup: #setupExpressionGrammar>
+ <benchmark: 'Petit Expression Grammar - Standard'>
+
+ input do: [ :source | parser parse: source withContext: context ]
+!
+
+benchmarkExpressionGrammarTokenizedC
+ <setup: #setupExpressionGrammarTokenized>
+ <teardown: #teardownExpressionGrammarTokenized>
+ <benchmark: 'Petit Expression Grammar - Tokenized'>
+
+
+ input do: [ :source | parser parse: source withContext: context ]
+!
+
benchmarkJavaSyntaxC
<setup: #setupJavaSyntax>
<benchmark: 'Petit Java Parser - Standard'>
@@ -354,6 +432,34 @@
!PPCBenchmark methodsFor:'setup & teardown'!
+setupExpressionGrammar
+
+ parser := PPExpressionGrammar new.
+ context := PPCContext new.
+ context initializeFor: parser.
+ input := sources expressionSourcesMedium.
+!
+
+setupExpressionGrammarCompiled
+
+ configuration := PPCConfiguration universal.
+ configuration arguments name: #PPCompiledExpressionGrammar.
+ parser := PPExpressionGrammar new compileWithConfiguration: configuration.
+ context := PPCContext new.
+ context initializeFor: parser.
+ input := sources expressionSourcesMedium.
+!
+
+setupExpressionGrammarTokenized
+
+ configuration := PPCConfiguration LL1.
+ configuration arguments name: #PPTokenizedLL1ExpressionGrammar.
+ parser := PPLL1ExpressionGrammar new compileWithConfiguration: configuration.
+ context := PPCContext new.
+ context initializeFor: parser.
+ input := sources expressionSourcesMedium.
+!
+
setupJavaSyntax
parser := PPJavaSyntax new.
@@ -375,6 +481,34 @@
"
!
+setupLL1ExpressionGrammar
+
+ parser := PPLL1ExpressionGrammar new.
+ context := PPCContext new.
+ context initializeFor: parser.
+ input := sources expressionSourcesBig.
+!
+
+setupLL1ExpressionGrammarCompiled
+
+ configuration := PPCConfiguration universal.
+ configuration arguments name: #PPCompiledLL1ExpressionGrammar.
+ parser := PPLL1ExpressionGrammar new compileWithConfiguration: configuration.
+ context := PPCContext new.
+ context initializeFor: parser.
+ input := sources expressionSourcesBig.
+!
+
+setupLL1ExpressionGrammarTokenized
+
+ configuration := PPCConfiguration universal.
+ configuration arguments name: #PPTokenizedLL1ExpressionGrammar.
+ parser := PPLL1ExpressionGrammar new compileWithConfiguration: configuration.
+ context := PPCContext new.
+ context initializeFor: parser.
+ input := sources expressionSourcesBig.
+!
+
setupRBParser
input := sources smalltalkSourcesBig.
@@ -434,6 +568,10 @@
input := sources smalltalkSourcesBig.
!
+teardownExpressionGrammarTokenized
+ parser class removeFromSystem.
+!
+
teardownJavaSyntaxCompiled
parser class removeFromSystem.
"