D2 TALA Open Source: I Benchmarked the New Layout Engine
TALA — Terrastruct's layout engine for software architecture diagrams — went MPL-2.0 open source yesterday after four years behind a commercial license. It ships bundled in D2 v0.9.0. I installed it, benchmarked it against dagre and ELK on seven workloads, and stress-tested the two claims the announcement makes: deterministic output, and layouts that "could look completely different" when you add one node. Verdict up front: TALA is 2–15x slower than dagre, and both headline claims check out — one of them in a way that should scare anyone using diagrams in CI.
Where the source actually lives
First quirk worth flagging: github.com/terrastruct/TALA still carries a placeholder LICENSE reading "TALA is currently closed-source." The real code landed inside the D2 monorepo — now at the d2lang/d2 org (25.2k stars, MPL-2.0) — under d2layouts/d2talalayout/. I cloned it sparse and counted: 107,793 lines of Go across 626 files, including 951 test functions. That's a serious drop, not a symbolic dump.
The architecture doc reveals why it's slow and why it's different from every DAG layouter you've used. TALA runs three independent layout attempts (seeds), scores each on aesthetic objectives — symmetry, median distance, flow, clustering — and keeps the best. The cost functions are all there in internal/placementcost/: symmetry.go, flow_continuity.go, edge_length.go. It's an optimizer, not a rule engine. That's the whole design tension in one file listing.
graph TD
A[D2 graph] --> B[adapter]
B --> C[seed 1]
B --> D[seed 2]
B --> E[seed 3]
C --> F[place nodes]
D --> F
E --> F
F --> G[route edges]
G --> H[validate + score]
H --> I[best of 3 seeds]
The benchmark: TALA vs dagre vs ELK
Machine: Linux x86-64 VM, D2 v0.9.0 binary release. Seven workloads: synthetic chain graphs of 2/10/50/100/200 nodes, a 45-node architecture diagram with five container groups, and a hybrid coordinate-locking case. Method: 3 warmups, 5 timed runs, medians below. Full wall time including process start and SVG write.
| Workload | dagre | elk | TALA | TALA overhead |
|---|---|---|---|---|
| 2 nodes | 50ms | 53ms | 79ms | 1.6x |
| 10 nodes | 51ms | 49ms | 73ms | 1.5x |
| 50 nodes | 68ms | 63ms | 272ms | 4.3x |
| 100 nodes | 86ms | 90ms | 557ms | 6.5x |
| 200 nodes | 138ms | 144ms | 1,830ms | 15x |
| arch (45 nodes, 5 groups) | 65ms | 71ms | 637ms | 10x |
| hybrid (coords + auto) | 50ms | 50ms | 73ms | 1.5x |
The growth is clearly superlinear — roughly O(n log n) or worse between 100 and 200 nodes. Terrastruct's own d2-benchmarks repo (also published yesterday, Apple M4) shows the same shape: TALA 98ms vs dagre 27ms at 100 nodes SVG. My numbers are 2–5x absolute slower across the board, which is what a shared VM vs an M4 does. The ratios match. Their numbers are honest.
Is 1.8s at 200 nodes a problem? For a human iterating in an editor, no — ELK is slower than you think. For agentic pipelines rendering diagrams on every commit or per-LLM-turn, it's real money at scale. That's the tradeoff TALA is asking you to make.
Determinism: tested, confirmed
The announcement promises: same seeds + same input → same diagram. I rendered the 45-node arch diagram twice and hashed the SVGs:
$ d2 --layout=tala gen/arch.d2 a1.svg
$ d2 --layout=tala gen/arch.d2 a2.svg
$ md5sum a1.svg a2.svg
aec63fc80ca6bf8b226949ef63344a94 a1.svg
aec63fc80ca6bf8b226949ef63344a94 a2.svg # byte-identical
Even more interesting: --tala-seeds 7,8,9 produced the same hash on this diagram. Three different random starts converged on one winning layout — the scorer is doing its job on this input. Don't generalize from one diagram, but the determinism guarantee itself is solid. This matters because AI-generated diagrams (their explicitly stated target use case) need reproducible output for diff-based review.
"Add one node, everything moves": also true
Second claim: adding a node can change the whole diagram, unlike dagre/ELK which accommodate incrementally. I rendered a 50-node chain, then appended one node and re-rendered:
47 of 50 shapes moved. Median displacement 21px, max 116.5px. So the document is technically honest — the layout "looks mostly the same" is doing heavy lifting; positions churn globally. For a whiteboard aesthetic that's fine. For CI diffing of SVGs, your every commit becomes a full re-layout. If you care about stable diffs, dagre remains the right tool; if you care about the one best picture, TALA wins.
Hybrid coordinates: the agentic killer feature works
TALA's unique pitch: pin some nodes, let the engine place the rest. I wrote a diagram with two pinned corners (a.near: top-left, b.near: top-right) and three auto nodes. TALA honored the pins exactly (rects at x=-114 and x=226, same y) and flowed the auto nodes between them below. This is the feature that makes sense for LLM diagram generation: models are decent at 2D sketching and terrible at edge routing. Let the model sketch, let TALA route. No other open layout engine offers this hybrid mode.
Bottom line
TALA open-sourcing is a genuine win for the diagram ecosystem — 107k lines of tested layout code went from closed to MPL-2.0 in a day, and everything I tested did what the docs claimed. But read the numbers before adopting: it's a quality optimizer, not a fast layouter. Use TALA for the architecture diagrams you show people, keep dagre for the ones a pipeline generates at scale. And if your diagrams live in CI, decide now whether you want byte-stable output or beautiful output — as of v0.9.0 you cannot have both.
- TALA is open-source — D2 Documentation, Sept 7 2026
- d2lang/d2 monorepo (TALA source at d2layouts/d2talalayout) — GitHub, MPL-2.0
- d2-benchmarks: reproducible CLI benchmarks — d2lang, Sept 7 2026
- terrastruct/TALA (legacy repo, still marked closed-source) — GitHub
Is TALA in D2 free now?
Yes. As of D2 v0.9.0 (released September 7, 2026), TALA is bundled into the free, MPL-2.0-licensed D2 binary. Pass --layout=tala to use it. The source lives in the d2lang/d2 monorepo under d2layouts/d2talalayout.
How much slower is TALA than dagre?
In my benchmarks on Linux x86-64: 1.5x slower at 10 nodes, 6.5x at 100 nodes (557ms vs 86ms), and 15x at 200 nodes (1,830ms vs 138ms). The gap widens superlinearly with diagram size, matching Terrastruct's own published benchmarks.
Is TALA layout deterministic?
Yes, with fixed seeds. TALA runs 3 layout attempts with default seeds 1,2,3 and keeps the best-scoring result. I verified byte-identical SVG output across repeated runs of the same input.
Can TALA combine manual and automatic layout?
Yes — it's TALA's unique feature. You can pin specific nodes with coordinates or near-constraints while TALA auto-places and edge-routes the rest. I verified a hybrid diagram renders correctly with pinned corners honored exactly.