You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce a CLI under `pkg/analyzer/tool/fine/ab_mutate` to compare the
conservative analyzer pipeline with the fine-grained dependencies
pipeline across seeded mutation chains. The tool applies deterministic
source mutations, collects diagnostics and timing for each engine, and
writes reproducible artifacts. Runs stop on divergence, exception, or
when a diagnostics cap is exceeded.
Key pieces:
- Engines: A = current state with conservative analysis without fine dependencies (not full rebuild without caching, but current coarse-grained incremental); B = incremental with `withFineDependencies`. A/B are warmed once, then performance counters are reset so the first mutation is incremental.
- Baseline: compute diagnostics for both engines and require equality before
running chains. The per-run diagnostics cap is `max(baseline*1.20, +50)`
unless explicitly set.
- Mutations (deterministic discovery & selection):
- `insert_unit_header_comment` (trivia only)
- `rename_local_variable` (declaration + local references in block)
- `remove_last_formal_parameter` (robust comma/group handling)
- `swap_top_level_functions` (preserves raw text/comments)
- `toggle_return_type_nullability` (named return types)
- Selection & editing:
- Separate `SiteSelector` context for parsed/resolved discovery so A/B stay
cold; edits are applied via `OverlayResourceProvider`.
- RNG is derived from a SHA-256–based 32-bit seed over structured parts for
stable, reproducible picks.
Outputs (for reproducibility and analysis):
- `manifest.json`, `files.json` (paths + SHA-256), and per-run `run_summary`.
- `baseline/diagnostics_{A,B}.json`, performance dumps, and a compare file.
- Per step: `mutation.json`, `before.dart`, `after.dart`, `patch.diff`,
`diagnostics_{A,B}.json`, `metrics_{A,B}.json`, performance, equality check,
and `diverge_details.json` when A≠B.
- Chain summary includes end reason, step list, per-kind counts, and p50/p90
speedup (A_time / B_time).
API & model additions:
- `Mutation`, `MutationEdit`, `MutationResult`, and `HarnessDiagnostic`
(normalized with stable `key()`); diagnostics use `ErrorProcessor` and skip
`TODO`s.
- Utility helpers for file discovery (skips generated/build/tool dirs), JSON
writing, deterministic seeding, and speedup stats.
Minor supporting change:
- Extend `FunctionAstVisitor` with `functionDeclaration` and
`methodDeclaration` callbacks and visit overrides. These are used by
mutation discovery (e.g., collecting bodies/identifiers for renames).
This adds an end-to-end, reproducible A/B harness for measuring
correctness and performance impacts of fine-grained dependencies on
realistic, evolving code, with minimal intrusion into the analyzer
proper.
Change-Id: I068138d6aa201ef9a79f884f0f4638d02c796b29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446480
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
0 commit comments