BlogsDatadogStatic Analyzer Migration to Rust

Static Analyzer Migration to Rust

Static Analyzer Migration to Rust

1
posts
2024

Datadog's static analyzer product, initially built in Java using ANTLR for parsing, has undergone a significant migration to Rust. This migration was driven by performance limitations and incomplete language support with the previous Java-based approach. The new architecture leverages Tree-sitter (implemented in Rust) for AST generation and Deno for JavaScript rule execution, resulting in a threefold performance increase and a tenfold reduction in memory usage. This enables faster scans in resource-constrained CI environments and broader language support.

2024

How we migrated our static analyzer from Java to Rust | Datadog

5/23/2024

This post details the technical migration of Datadog's static analyzer from Java to Rust. Key technical decisions included switching from ANTLR to Tree-sitter for AST generation, leveraging Tree-sitter's Rust bindings for improved performance and language support. The JavaScript runtime was migrated from GraalVM to Deno (via the deno-core crate) for security and efficiency. The post outlines the architectural changes, the benefits of Rust (performance, memory usage), and the team's experience learning Rust for the migration. It also details the mapping of Java libraries to their Rust equivalents for core functions like AST building, YAML parsing, HTTP client usage, and concurrent execution.