@@ -8,19 +8,7 @@ package dotc
8
8
import core .Contexts .Context
9
9
import reporting .Reporter
10
10
11
- /* To do:
12
- * - simplify hk types
13
- * - have a second look at normalization (leave at method types if pt is method type?)
14
- * - Don't open package objects from class files if they are present in source
15
- * - Revise the way classes are inherited - when not followed by [...] or (...),
16
- * assume the unparameterized type and forward type parameters as we do now for the synthetic head class.
17
- */
18
11
object Bench extends Driver {
19
- def resident (compiler : Compiler ): Reporter = unsupported(" resident" ) /* loop { line =>
20
- val command = new CompilerCommand(line split "\\s+" toList, new Settings(scalacError))
21
- compiler.reporter.reset()
22
- new compiler.Run() compile command.files
23
- }*/
24
12
25
13
private var numRuns = 1
26
14
@@ -29,29 +17,25 @@ object Bench extends Driver {
29
17
private def ntimes (n : Int )(op : => Reporter ): Reporter =
30
18
(emptyReporter /: (0 until n)) ((_, _) => op)
31
19
32
- override def doCompile (compiler : Compiler , fileNames : List [String ], reporter : Option [Reporter ] = None )
33
- (implicit ctx : Context ): Reporter =
34
- if (new config.Settings .Setting .SettingDecorator [Boolean ](ctx.base.settings.resident).value(ctx))
35
- resident(compiler)
36
- else
37
- ntimes(numRuns) {
38
- val start = System .nanoTime()
39
- val r = super .doCompile(compiler, fileNames, reporter)
40
- ctx.println(s " time elapsed: ${(System .nanoTime - start) / 1000000 }ms " )
41
- r
42
- }
20
+ override def doCompile (compiler : Compiler , fileNames : List [String ])(implicit ctx : Context ): Reporter =
21
+ ntimes(numRuns) {
22
+ val start = System .nanoTime()
23
+ val r = super .doCompile(compiler, fileNames)
24
+ println(s " time elapsed: ${(System .nanoTime - start) / 1000000 }ms " )
25
+ r
26
+ }
43
27
44
28
def extractNumArg (args : Array [String ], name : String , default : Int = 1 ): (Int , Array [String ]) = {
45
29
val pos = args indexOf name
46
30
if (pos < 0 ) (default, args)
47
31
else (args(pos + 1 ).toInt, (args take pos) ++ (args drop (pos + 2 )))
48
32
}
49
33
50
- override def process (args : Array [String ], rootCtx : Context , reporter : Option [ Reporter ] = None ): Reporter = {
34
+ override def process (args : Array [String ], rootCtx : Context ): Reporter = {
51
35
val (numCompilers, args1) = extractNumArg(args, " #compilers" )
52
36
val (numRuns, args2) = extractNumArg(args1, " #runs" )
53
37
this .numRuns = numRuns
54
- ntimes(numCompilers)(super .process(args2, rootCtx, reporter ))
38
+ ntimes(numCompilers)(super .process(args2, rootCtx))
55
39
}
56
40
}
57
41
0 commit comments