Datadog

How we improved APM Java startup by encoding a prefix trie as a JVM constant | Datadog

Aug 11, 2026Stuart McCulloch
How we improved APM Java startup by encoding a prefix trie as a JVM constant | Datadog
SummaryAI, from the source post

The Datadog APM Java team optimized class matching during startup by encoding a prefix trie as a single JVM constant. This constant is loaded with a single bytecode instruction (`ldc`), eliminating the need for resource lookups and file parsing in the constrained `premain` phase. The trie is stored as a sequence of chars, where each char can hold control information and content. Each node in the trie is encoded with the number of branches, branch characters, branch values, and jump offsets.