From 4ca8744da021642d9f943224950482b3344cf089 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 29 Nov 2015 18:17:54 +0100 Subject: Avoid too eager computation in reporting. I noted a slowdown of about 25% (66sec -> 81sec) when compiling dotty even after the subtype optimization (before it was 117sec). I tracked it down to the traceIndented fix which avoided questions to be evaluated twice. But it also caused the question to be evaluated Making the val lazy fixed the problem. --- src/dotty/tools/dotc/reporting/Reporter.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/reporting') diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala index 5cad0a077..f98d85ce9 100644 --- a/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/src/dotty/tools/dotc/reporting/Reporter.scala @@ -155,7 +155,7 @@ trait Reporting { this: Context => else { // Avoid evaluating question multiple time, since each evaluation // may cause some extra logging output. - val q: String = question + lazy val q: String = question traceIndented[T](s"==> $q?", (res: Any) => s"<== $q = ${resStr(res)}")(op) } } -- cgit v1.2.3