---
title: "Lazy BDDs with eager literal differences"
url: https://daily.dev/posts/lazy-bdds-with-eager-literal-differences-utpsbskcr
source_url: http://elixir-lang.org/blog/2026/03/19/lazy-bdds-with-eager-literal-differences/
type: article
source: "Elixir"
published: 2026-03-19T09:52:30.608Z
updated: 2026-03-30T02:17:45.740Z
tags: ["compiler-optimization", "elixir"]
reading_time: 11
upvotes: 18
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Lazy BDDs with eager literal differences

**[Elixir](https://daily.dev/sources/elixir)** · 11 min read · 18 upvotes · 0 comments

## Summary

José Valim details new optimizations to Elixir's set-theoretic type system targeting difference operations in lazy BDDs (Binary Decision Diagrams). With Elixir v1.20.0-rc.2 introducing clause-type propagation and redundant clause detection, the number of type difference computations increased significantly, causing compilation slowdowns in modules with 1000+ clauses. The post derives new mathematical formulas for eager literal differences — both when a literal appears on the left or right side of a difference — and introduces a 'one field difference' optimization for structs where only a single field type differs. These optimizations, shipping in v1.20.0-rc4, reduced compilation from dozens of seconds to milliseconds for affected projects. Claude Opus 4.6 is credited with suggesting a key algebraic simplification.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <http://elixir-lang.org/blog/2026/03/19/lazy-bdds-with-eager-literal-differences/>

## Similar posts on daily.dev

- [Lazy BDDs with eager literal intersections](https://daily.dev/posts/lazy-bdds-with-eager-literal-intersections-jrqly4sxw) · Elixir · 24 upvotes · 0 comments
- [Lazier Binary Decision Diagrams \(BDDs\) for set-theoretic types](https://daily.dev/posts/lazier-binary-decision-diagrams-bdds-for-set-theoretic-types-wycdb5gsa) · Elixir · 4 upvotes · 1 comments
- [Elixir v1.20 released: now a gradually typed language](https://daily.dev/posts/elixir-v1-20-released-now-a-gradually-typed-language-081x31cuq) · Elixir · 4 upvotes · 0 comments

---

Tags: [#compiler-optimization](https://daily.dev/tags/compiler-optimization), [#elixir](https://daily.dev/tags/elixir)

[View this post on daily.dev](https://daily.dev/posts/lazy-bdds-with-eager-literal-differences-utpsbskcr)
