Skip to content

Optimize Definitions.isStable to avoid expensive path through ExistentialType.bounds #545

Open
@retronym

Description

@retronym

Profiles reveal a hotspot at:

case TypeRef(_, sym, _) if sym.isAbstractType     => tp.bounds.hi.typeSymbol isSubClass SingletonClass

When tp is an ExistentialType, which defines:

override def bounds = TypeBounds(maybeRewrap(underlying.bounds.lo), maybeRewrap(underlying.bounds.hi))
  • Avoid repeated calls to underlying.bounds
  • Are there cheap tests we can make on underlying.bounds.{lo,hi} to avoid the need to call maybeRewrap? Perhaps Any / Nothing` are common and don't need to be wrapped in the existential?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions