aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/sbt
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-02 19:11:34 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:12 +0200
commitd0efabf2817468c248db8a2a6d5a6c0b58747867 (patch)
tree7f9c04d5631f1a204a8b343de1623cd2c57848e7 /compiler/src/dotty/tools/dotc/sbt
parent264211f6b7129923c01c2e3c402b157685d64b1f (diff)
downloaddotty-d0efabf2817468c248db8a2a6d5a6c0b58747867.tar.gz
dotty-d0efabf2817468c248db8a2a6d5a6c0b58747867.tar.bz2
dotty-d0efabf2817468c248db8a2a6d5a6c0b58747867.zip
Lazy entering of names with internal $'s in package scopes
Names with internal $'s are entered in package scopes only if - we look for a name with internal $'s. - we want to know all the members of a package scope This optimization seems to be fairly effective. The typical range of package scopes that need $-names is between 0 and 20%. The optimization seems to improve execution time of all unit tests by about 3%. Also. drop the inheritance from Iterable to Scope. The reason is that we now need a context parameter for toList and other Iterable operations which makes them impossible to fit into the Iterable framework.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/sbt')
-rw-r--r--compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
index db19bf6b6..5488d1979 100644
--- a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
+++ b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
@@ -214,7 +214,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
// and can therefore be ignored.
def alwaysPresent(s: Symbol) =
s.isCompanionMethod || (csym.is(ModuleClass) && s.isConstructor)
- val decls = cinfo.decls.filterNot(alwaysPresent).toList
+ val decls = cinfo.decls.filter(!alwaysPresent(_)).toList
val apiDecls = apiDefinitions(decls)
val declSet = decls.toSet
@@ -224,7 +224,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
// We cannot filter out `LegacyApp` because it contains the main method,
// see the comment about main class discovery in `computeType`.
.filter(bc => !bc.is(Scala2x) || bc.eq(LegacyAppClass))
- .flatMap(_.classInfo.decls.filterNot(s => s.is(Private) || declSet.contains(s)))
+ .flatMap(_.classInfo.decls.filter(s => !(s.is(Private) || declSet.contains(s))))
// Inherited members need to be computed lazily because a class might contain
// itself as an inherited member, like in `class A { class B extends A }`,
// this works because of `classLikeCache`