Skip to content

Experiment: Simplify SimpleIdentityMap/Set - #26713

Draft
SolalPirelli wants to merge 2 commits into
scala:mainfrom
dotty-staging:solal/experiment-simple-identity-map
Draft

Experiment: Simplify SimpleIdentityMap/Set#26713
SolalPirelli wants to merge 2 commits into
scala:mainfrom
dotty-staging:solal/experiment-simple-identity-map

Conversation

@SolalPirelli

Copy link
Copy Markdown
Contributor

There have been a number of experiments recently around data structures in the compiler.

One learning is that megamorphic dispatch can make the "more efficient subclasses" pattern perform worse than having a single general-purpose structure.

So let's see what happens with this... Locally on areWeFastYet it seems to make no difference.

Have you relied on LLM-based tools in this contribution?

No

How was the solution tested?

Covered by existing tests (this is a refactoring)

map2(assocToString) mkString ("(", ", ", ")")
}
}
final class SimpleIdentityMap[K <: AnyRef, +V <: AnyRef](bindings: Array[AnyRef]) extends (K => V | Null) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for myself, can this be an AnyVal?

@dottybot

dottybot commented Aug 9, 2026

Copy link
Copy Markdown
Member

Benchmarks started. Workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants