Skip to content

Use perf-boosting custom hash for ordering maps and tuples#15398

Open
gldubc wants to merge 2 commits into
elixir-lang:mainfrom
gldubc:map-leaf-hash-order
Open

Use perf-boosting custom hash for ordering maps and tuples#15398
gldubc wants to merge 2 commits into
elixir-lang:mainfrom
gldubc:map-leaf-hash-order

Conversation

@gldubc
Copy link
Copy Markdown
Member

@gldubc gldubc commented May 16, 2026

Map literals with a smaller hash get ordered higher in the BDD. If we use a negative hash for the :closed maps, then they will appear higher in BDDs and this will factor them (instead of having it multiplied on every leaf). We can also add a weight for the number of fields, so that more fields appear higher than less fields.

The same can be done for tuples as well.

The performance boost appears when using plain bdd operations (e.g. Livebook typechecking goes from 750ms to the usual ~280ms).

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant