Repository navigation
ci: add benchmarks and CodSpeed performance tracking - #149
Conversation
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master |
Rust Diff AnalysisTip PR size is within limits. Good job keeping changes focused! Limits — configured thresholds for this repository
Understanding the metrics:
Summary — breakdown of changes by category
Production Changes — 2 units modified
Test Changes — 21 units modified
Analysis ScopeAnalyzed: 2 Rust files Skipped files:
Skipped file list:
|
Cargo Quality AnalysisTip All quality checks passed. Code meets all standards! Results — issues found by each analyzer
Analyzers — what each check does
Raw Output — detailed analysis log |
Congrats! CodSpeed is installed 🎉
You will start to see performance impacts in the reports once the benchmarks are run from your default branch. 1 warning
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This PR adds benchmarks for the static analysis pipeline and runs them with CodSpeed on every pull request and on
main. CodSpeed posts a report on each pull request that compares every benchmark withmainand flags regressions before merge. The CodSpeed report on this PR lists all 17 benchmarks.What changed
Benchmarks (
benches/analyzer.rs), written with divan throughcodspeed-divan-compat(dev-dependency only, renamed todivan). They cover the code that runs on every CLI invocation:parse_queries_generic[10/100],parse_queries_postgres[10/100]parse_querieson a mix of 20 query shapes (joins, CTEs, subqueries, IN lists, UNION, INSERT/UPDATE/DELETE)parse_schema_genericSchema::parseof 60 tables with indexesparse_schema_clickhouse,preprocess_clickhouseCODEC,PARTITION BYandSETTINGSanalyze_rules[10/100],analyze_rules_with_schema[10/100]RuleRunner::analyzewith all rules, without and with the schema-aware rulesbuild_rule_runner_with_schemaformat_report[text/json/sarif]format_static_analysisfor a 100-query reportfull_static_pipeline[10/100]analyzedoes without file I/O and LLM callsThe benchmark binary runs rayon on one thread. CodSpeed's CPU simulation counts CPU work, and with several rayon threads the results moved by up to 12% between identical runs because of thread scheduling. With one thread, two runs gave the same numbers.
CI (
.github/workflows/codspeed.yml): builds the benchmarks withcargo-codspeedand runs them withCodSpeedHQ/actionv5.8.0 insimulationmode. Authentication uses OIDC (id-token: write), so no secret token is needed. Actions are pinned by commit hash like the other workflows.benches/**is also added to the Rust paths filter in_detect.yml, so fmt and clippy run when only benchmarks change.README: CodSpeed badge, and a short "Benchmarks" section under "Performance" with the commands to run them locally.
Build fix (
src/query/extract/expr.rs):maindoes not compile right now. Dependabot bumpedsqlparserto 0.64 in #144, and 0.64 mergedExpr::InListandExpr::InSubqueryintoExpr::In { target: InTarget, .. }. The four match arms now useExpr::InwithInTarget::List/InTarget::Subquery. The behavior stays the same: other targets (such asUNNEST) fell through to_before and still do. All tests pass (cargo test --all-features, and the Test job here). This is in its own commit, so it can be split out if you prefer.Running locally
cargo bench --bench analyzer # With the CodSpeed CLI cargo install cargo-codspeed --locked cargo codspeed build -m simulation codspeed run -m simulation -- cargo codspeed runCI status
auditanddenyfail, and soCI Successfails. This PR does not cause it: the advisories are forrustls0.23.43 (RUSTSEC-2026-0285, -0346, -0348, -0349, -0382) andurl2.5.8 (RUSTSEC-2026-0592), which are already inCargo.lockonmain. These jobs run here becauseCargo.lockchanged.cargo update -p rustls -p urlin a separate PR should fix them. Licenses and bans pass for the new dev-dependencies.Notes
preprocess_clickhouseis slow for its job (about 26 ms in CI for 40 tables):normalize_whitespacecompiles a newRegexon every call.TTL_REGEXalso removes the terminating;. A schema with aTTLtable followed by another statement, or withTTL ... SETTINGS ..., fails to parse. For this reason the ClickHouse benchmark input does not useTTL.ubuntu-latest. It counts instructions, so results do not depend on the noise of the CI machine.Comment this and I'll do it: