---
title: "Lazy BDDs with eager literal intersections"
url: https://daily.dev/posts/lazy-bdds-with-eager-literal-intersections-jrqly4sxw
source_url: http://elixir-lang.org/blog/2026/02/26/eager-literal-intersections/
type: article
source: "Elixir"
published: 2026-02-26T09:28:06.969Z
updated: 2026-03-30T02:17:42.417Z
tags: ["compiler-optimization", "elixir"]
reading_time: 11
upvotes: 24
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 intersections

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

## Summary

José Valim details the latest optimizations to Elixir's set-theoretic type system, specifically the introduction of eager literal intersections on top of the lazy BDD representation introduced in v1.19. Lazy BDDs avoid flattening complex type expressions but can leave redundant nodes when intersections could be resolved immediately. The new optimization eagerly computes intersections between literal nodes in the BDD tree, dramatically reducing tree size and type-checking time—one pathological case dropped from 10 seconds to 25ms. The post covers the mathematical derivation of the optimization, its application to differences, the open vs. closed map trade-off that caused a performance regression in the initial implementation, and how restricting the optimization to closed maps resolved it.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <http://elixir-lang.org/blog/2026/02/26/eager-literal-intersections/>

## Similar posts on daily.dev

- [Lazy BDDs with eager literal differences](https://daily.dev/posts/lazy-bdds-with-eager-literal-differences-utpsbskcr) · Elixir · 18 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

---

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-intersections-jrqly4sxw)
