@@ -23,10 +23,10 @@ abstract class AnalysisComparisonAlt[Num: IntLattice, Rea: RealLattice, Bln: Boo
2323 // - the number of runs for the concrete interpreter
2424 def analyses : List [(SchemeExp => Analysis , String )]
2525 def benchmarks : List [Benchmark ]
26- def runs = 3 // number of runs for the concrete interpreter
26+ def runs = 1 // number of runs for the concrete interpreter
2727
2828 // and can, optionally, be configured in its timeouts (default: 10min.) and the number of concrete runs
29- def timeout () = Timeout .start(Duration (10 , MINUTES )) // timeout for the analyses
29+ def timeout () = Timeout .start(Duration (5 , MINUTES )) // timeout for the analyses
3030
3131 // keep the results of the benchmarks in a table
3232 enum Result :
@@ -80,10 +80,13 @@ abstract class AnalysisComparisonAlt[Num: IntLattice, Rea: RealLattice, Bln: Boo
8080
8181 private def runBenchmarks (benchmarks : List [Benchmark ], outputFolder : Option [String ] = None ) =
8282 assert(benchmarks.size == benchmarks.toSet.size) // sanity check to make sure we don't have duplicates
83- benchmarks.foreach(runBenchmark)
84- showResults(outputFolder)
83+ benchmarks.foreach { benchmark =>
84+ runBenchmark(benchmark)
85+ writeResultsToFile(outputFolder)
86+ }
87+ showResults()
8588
86- protected def showResults (outputFolder : Option [ String ] ) =
89+ protected def showResults () =
8790 println()
8891 println(" PRECISION RESULTS" )
8992 println(" =================" )
@@ -94,16 +97,18 @@ abstract class AnalysisComparisonAlt[Num: IntLattice, Rea: RealLattice, Bln: Boo
9497 println(" ===================" )
9598 println()
9699 println(performanceResults.prettyString())
97- outputFolder.foreach { dir =>
98- writeToFile(precisionResults, s " $dir/precision-benchmarks.csv " )
99- writeToFile(performanceResults, s " $dir/performance-benchmarks.csv " )
100- }
101100
102101 protected def writeToFile [X ](results : Table [X ], path : String ) =
103102 val writer = Writer .open(path)
104103 Writer .write(writer, results.toCSVString(rowName = " benchmark" ))
105104 Writer .close(writer)
106105
106+ protected def writeResultsToFile (outputFolder : Option [String ]) =
107+ outputFolder.foreach { dir =>
108+ writeToFile(precisionResults, s " $dir/precision-benchmarks.csv " )
109+ writeToFile(performanceResults, s " $dir/performance-benchmarks.csv " )
110+ }
111+
107112 def main (args : Array [String ]) = runBenchmarks(benchmarks, args.headOption)
108113
109114
@@ -123,6 +128,9 @@ abstract class SASBenchmarks
123128 lazy val dss0 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modflocalAnalysis(_, 0 ), " 0-CFA DSS" )
124129 lazy val dss1 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modflocalAnalysis(_, 1 ), " 1-CFA DSS" )
125130 lazy val dss2 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modflocalAnalysis(_, 2 ), " 2-CFA DSS" )
131+ lazy val adi0 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modfADIAnalysis(_, 0 ), " 0-CFA ADI" )
132+ lazy val adi1 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modfADIAnalysis(_, 1 ), " 1-CFA ADI" )
133+ lazy val adi2 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modfADIAnalysis(_, 2 ), " 2-CFA ADI" )
126134 lazy val dssFS0 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modflocalFSAnalysis(_, 0 , true ), " 0-CFA DSS-FS" )
127135 lazy val dssFS1 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modflocalFSAnalysis(_, 1 , true ), " 1-CFA DSS-FS" )
128136 lazy val dssFS2 : (SchemeExp => Analysis , String ) = (SchemeAnalyses .modflocalFSAnalysis(_, 2 , true ), " 2-CFA DSS-FS" )
@@ -144,6 +152,18 @@ abstract class SASBenchmarks
144152 // "triangl" <- times out in concrete interpreter
145153 ).map(name => s " test/R5RS/gabriel/ $name.scm " )
146154
155+ def slowBenchmarks =
156+ List (
157+ " boyer" ,
158+ " browse" ,
159+ " destruc"
160+ ).map(name => s " test/R5RS/gabriel/ $name.scm " )
161+ ++
162+ List (
163+ " test/R5RS/gambit/matrix.scm" ,
164+ " test/R5RS/various/mceval.scm" ,
165+ )
166+
147167 def extraBenchmarks =
148168 List (
149169 " test/R5RS/various/grid.scm" ,
@@ -188,26 +208,44 @@ object Table4Benchmarks extends SASBenchmarks:
188208 dssFS0NoGC, dssFS1NoGC, dssFS2NoGC
189209 )
190210
211+ object ADIBenchmarks extends SASBenchmarks :
212+ def analyses = List (
213+ dss0, dss1, dss2,
214+ adi0, adi1, adi2
215+ )
216+
217+ object DSS2Benchmark extends SASBenchmarks :
218+ def analyses = List (dssFS2NoGC)
219+ override def benchmarks = List (" test/R5RS/gabriel/boyer.scm" )
220+
191221object CountIterationBenchmark extends SASBenchmarks :
192222
193223 def analyses = List (
194224 dssFS0, dssFS0NoGC
195225 )
196226
197- var results : Table [Int ] = Table .empty
227+ var results : Table [Option [ Long ] ] = Table .empty
198228
199229 override protected def forBenchmark (path : Benchmark , program : SchemeExp ): Unit =
200230 println(s " ANALYZING $path" )
201231 analyses.foreach { case (analysis, name) =>
202232 val anl = analysis(program)
203233 anl.analyzeWithTimeout(Timeout .start(Duration (15 , MINUTES )))
204- results = results.add(path, name, anl.asInstanceOf [SchemeModFLocalFS ].iterations)
234+ val res = anl.asInstanceOf [SchemeModFLocalFS ].computeOneCountsPercentage.map(_ * 100 )
235+ results = results.add(path, name, res.map(_.round))
205236 }
206237
207238 override def timeout () = Timeout .none
208239
209- override protected def showResults (outputFolder : Option [String ]) =
210- println(results.prettyString())
240+ private def showResult (res : Option [Long ]): String =
241+ res match
242+ case None => " N/A"
243+ case Some (value) => s " $value% "
244+
245+ override protected def showResults () =
246+ println(results.prettyString(format= showResult))
247+
248+ override protected def writeResultsToFile (outputFolder : Option [String ]) =
211249 outputFolder.foreach { dir =>
212250 writeToFile(results, s " $dir/iteration-benchmarks.csv " )
213251 }
0 commit comments