From 489930498434771cd70fde5761f395048855f1e6 Mon Sep 17 00:00:00 2001 From: Karn Date: Sun, 19 Jul 2026 01:45:58 +0530 Subject: [PATCH] maint: speed up debug-build detection after signature v2 Cold detection over a large history was ~138s in a debug build versus ~11s in release. Signature normalization (ADR 0014) runs several regex passes over every tool command, and in a fully unoptimized build both the regex engine and the workspace's own normalizer/detector code run slow. Optimize third-party dependencies (`opt-level = 2`) plus the two hot workspace crates (`autophagy-events`, `autophagy-patterns`) in the dev profile. The rest of the workspace stays unoptimized so incremental rebuilds during development remain fast. No source or behavior change; detection output is byte-identical. Co-Authored-By: Claude Fable 5 --- Cargo.toml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 9acd50e..452008d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,3 +48,24 @@ unsafe_code = "forbid" all = { level = "warn", priority = -1 } pedantic = { level = "warn", priority = -1 } module_name_repetitions = "allow" + +# Dependencies compiled with optimizations even in the dev profile. Signature +# normalization (ADR 0014) runs several `regex` passes over every tool command, +# and an unoptimized regex engine is a large part of what makes a cold detection +# pass over a big history crawl (~130s on a 69k-event database in a fully +# unoptimized build). Third-party dependencies change rarely, so optimizing them +# costs a one-time longer build but not day-to-day incremental rebuilds. +# Detection output is byte-identical regardless of opt level. +[profile.dev.package."*"] +opt-level = 2 + +# The signature normalizer (`autophagy-events`) and the recurrence detectors +# (`autophagy-patterns`) are the workspace's own hot path during detection. +# Optimizing just these two crates recovers the rest of the gap (down to ~12s, +# on par with a release build) without slowing incremental rebuilds of the rest +# of the workspace. +[profile.dev.package.autophagy-events] +opt-level = 2 + +[profile.dev.package.autophagy-patterns] +opt-level = 2