aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-11-29 18:17:54 +0100
committerGuillaume Martres <smarter@ubuntu.com>2015-11-30 17:31:32 +0100
commit4ca8744da021642d9f943224950482b3344cf089 (patch)
tree8e84cd866737b2c3bdffe2620d200bd97c7bd3e9 /src/dotty/tools/dotc/reporting
parentbced61d0bb58e8e4da1c7e8ececb1c24b5e81843 (diff)
downloaddotty-4ca8744da021642d9f943224950482b3344cf089.tar.gz
dotty-4ca8744da021642d9f943224950482b3344cf089.tar.bz2
dotty-4ca8744da021642d9f943224950482b3344cf089.zip
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.
Diffstat (limited to 'src/dotty/tools/dotc/reporting')
-rw-r--r--src/dotty/tools/dotc/reporting/Reporter.scala2
1 files changed, 1 insertions, 1 deletions
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)
}
}