Skip to content

Commit 4fb04d3

Browse files
committed
Reorder pattern match based on frequency
NamedPartsAccumulator.apply total number of matches when compiling the dotty bootstrapped compiler (TypeRef,255627) (ThisType,128253) (NoPrefix,67972) (TermRef,33240) (AppliedType,22874) (default,13428) (TypeBounds,5013) (ParamRef,3931) (ConstantType,1893)
1 parent 57661ee commit 4fb04d3

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4315,19 +4315,23 @@ object Types {
43154315
else {
43164316
seen += tp
43174317
tp match {
4318-
case tp: TermRef =>
4319-
apply(foldOver(maybeAdd(x, tp), tp), tp.underlying)
43204318
case tp: TypeRef =>
43214319
foldOver(maybeAdd(x, tp), tp)
4320+
case tp: ThisType =>
4321+
apply(x, tp.tref)
4322+
case NoPrefix =>
4323+
foldOver(x, tp)
4324+
case tp: TermRef =>
4325+
apply(foldOver(maybeAdd(x, tp), tp), tp.underlying)
4326+
case tp: AppliedType =>
4327+
foldOver(x, tp)
43224328
case TypeBounds(lo, hi) =>
43234329
if (!excludeLowerBounds) apply(x, lo)
43244330
apply(x, hi)
4325-
case tp: ThisType =>
4326-
apply(x, tp.tref)
4327-
case tp: ConstantType =>
4328-
apply(x, tp.underlying)
43294331
case tp: ParamRef =>
43304332
apply(x, tp.underlying)
4333+
case tp: ConstantType =>
4334+
apply(x, tp.underlying)
43314335
case _ =>
43324336
foldOver(x, tp)
43334337
}

0 commit comments

Comments
 (0)