Fix performance issue for case when there are a lot of warnings in file

There was a problem with `reportDiagnosticOnce` method which was
 called, for example, to report diagnostics about experimentalities. It
 was crucial for code as in the issue (KT-34204).

 The whole complexity was "count of experimental diagnostics" multiply
 "count of all diagnostics" multiply very large constant. Almost on
 each `reportDiagnosticOnce` method `readonlyView()` was called which
 in turn called computation of cache. During cache computation we were
 iterating through the all diagnostics and also were using
 KotlinSuppressCache, which is not very fast.

 #KT-34204 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-10-10 09:42:19 +03:00
parent 71cb5e07db
commit 3d8e5c4f8e
6 changed files with 32 additions and 10 deletions
@@ -336,6 +336,9 @@ private class LazyJvmDiagnostics(compute: () -> Diagnostics) : Diagnostics {
override fun noSuppression() = delegate.noSuppression()
override fun hasDiagnostic(diagnostic: Diagnostic) =
delegate.hasDiagnostic(diagnostic)
override fun iterator() = delegate.iterator()
}