bench(routing): add criterion bench for classify_complexity (target 0.1ms)#270
Merged
Destynova2 merged 1 commit intomainfrom Apr 25, 2026
Merged
bench(routing): add criterion bench for classify_complexity (target 0.1ms)#270Destynova2 merged 1 commit intomainfrom
Destynova2 merged 1 commit intomainfrom
Conversation
….1ms) Three scenarios measure the cost of the heuristic complexity classifier to validate the "stateless ~0.1ms" design goal. Results well under target. Local results (Apple Silicon): classify_trivial ~145 ns (≈ 690x under 100µs target) classify_medium ~33 ns (≈ 3000x under target) classify_complex ~410 ns (≈ 240x under target) Bench is local-only (cargo bench is not in CI today; staying consistent). Side change: re-export `classify_complexity` from `routing::classify` so external callers (benches, MCP tools) don't need the awkward double `classify::classify::classify_complexity` path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Criterion bench validating the "stateless ~0.1ms" design goal for the heuristic complexity classifier. Results are well under target.
Local results (Apple Silicon, dev profile)
`classify_medium` is faster than `classify_trivial` because the medium request has fewer alphanumeric tokens that match the keyword regex set; the trivial "What is 2+2?" forces a full token scan.
Files changed
Test plan
Note
Bench is local-only — `cargo bench` is not in CI today, this PR stays consistent with that policy. The numbers are captured in the commit body for future reference.