Using lazy BDD structure for functions#14799
Closed
gldubc wants to merge 8 commits intoelixir-lang:mainfrom
Closed
Using lazy BDD structure for functions#14799gldubc wants to merge 8 commits intoelixir-lang:mainfrom
gldubc wants to merge 8 commits intoelixir-lang:mainfrom
Conversation
Lazy BDDS: ternary trees (instead of binary) where the additional node encodes a lazy union. See "COVARIANCE AND CONTRAVARIANCE: A FRESH LOOK AT AN OLD ISSUE"
sabiwara
reviewed
Sep 29, 2025
|
|
||
| # Optional guard: blow up if someone passes a binary node by mistake | ||
| defp lazy_bdd_to_dnf(_acc, _pos, _neg, {_lit, _t, _e}) do | ||
| raise ArgumentError, "lazy_bdd_to_dnf expects lazy nodes {lit, c, u, d}" |
Contributor
There was a problem hiding this comment.
Might be better to just remove the clause or add the value in the error message for debugging?
Suggested change
| raise ArgumentError, "lazy_bdd_to_dnf expects lazy nodes {lit, c, u, d}" | |
| raise ArgumentError, "lazy_bdd_to_dnf expects lazy nodes {lit, c, u, d}, got: #{inspect(tuple)}" |
Member
Author
There was a problem hiding this comment.
I will remove once I have really made sure this case cannot happen (I have just noticed this clause hits when compiling HexPm)
Member
Author
There was a problem hiding this comment.
Nevermind, it all compiles well, this was a cache issue!
josevalim
reviewed
Sep 29, 2025
| end | ||
| end | ||
|
|
||
| def lazy_bdd_union(bdd1, bdd2) do |
Member
There was a problem hiding this comment.
Remember to make all of them private :)
Now it only seems to appear in artificial examples.
Remark: best 1.19 performance, similar to 1.18 speed!
josevalim
reviewed
Sep 30, 2025
| end | ||
|
|
||
| @compile {:inline, map_union: 2} | ||
| def map_union(bdd1, bdd2), do: bdd_union(bdd1, bdd2) |
Member
There was a problem hiding this comment.
Suggested change
| def map_union(bdd1, bdd2), do: bdd_union(bdd1, bdd2) | |
| defp map_union(bdd1, bdd2), do: bdd_union(bdd1, bdd2) |
josevalim
reviewed
Sep 30, 2025
| end | ||
| end | ||
|
|
||
| ## Lazy BDD helpers |
Member
There was a problem hiding this comment.
Suggested change
| ## Lazy BDD helpers | |
| ## Lazy BDD helpers | |
| @compile {:inline, lazy_bdd_new: 1, lazy_bdd_new: 3} |
Member
|
Closing in favour of #14806 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From p.35 of https://www.irif.fr/~gc/papers/covcon-again.pdf
This improves consecutive unions of function types greatly.
This also solves the long compilation time for Spitfire encountered in #14693