Migrating our DOM to Zig - Blog
Lightpanda replaced LibDOM with a custom Zig-based DOM implementation called zigdom to resolve friction between V8, Zig, and LibDOM layers. The original architecture created challenges with events, Custom Elements, and ShadowDOM integration. After six months of prototyping, they built a unified DOM with optimized memory layout (single allocation for node hierarchies), lazy property loading to reduce per-element overhead, and integrated Rust's html5ever parser. They also implemented V8 snapshots to reduce startup time by 10-30% for simple pages. While performance gains are modest (single-digit percentages), the primary benefit is a cohesive codebase that simplifies future feature development.