Skip to content

Prepare immutable file-diff configuration once per style - #1055

Merged
helly25 merged 12 commits into
mainfrom
perf/prepare-diff-configuration
Nov 2, 2026
Merged

helly25 merged 12 commits into
mainfrom
perf/prepare-diff-configuration

Conversation

@helly25

@helly25 helly25 commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

File-diff actions now reuse their resolved normalization settings instead of compiling the same ignored-line regex for every file pair. Targeted native workloads improve about 19% on Linux and 6% on macOS, with existing output and conditional-read behavior preserved.

AG;DR

Base: main after merged #1053 and #1054. Synchronization incorporates current main without changing the verified implementation tree (checked against bc4294e). Use the resulting pushed-head PR-context checks for readiness.

Implementation:

  • Prepare one complete immutable DiffOptions record for each distinct action style, after existing whole-command validation. Resolve global defaults, per-action format/context overrides, algorithm, normalization tokens and RE2 ignored-line expressions once per style.
  • Pass a const observer through EvalContext. Reached diff callbacks borrow the matching style record after their existing reads, byte-equality and binary branches. The style key remains valid for cloned/deferred expression nodes.
  • Preserve lazy context-dependent construction for direct evaluator users and missing table entries. Peer templates/rendering, I/O, patch labels/claims, short-circuiting, safety and output order remain unchanged.
  • DiffOptions embeds noncopyable RE2 state: records use ordinary unique ownership, without new reference-counted wrappers, per-file locks, workers, clocks or mutation routes. Comparison-mode patches already have separately prepared options and are unchanged.
  • Add an independent in-memory regression target and whole-engine benchmark scenarios. Reconcile O15a with existing EP03/EP07 docs/TODO. Hash-spec/default binding and broader template/executor qualifications remain open.

Measured evidence and limitations:

  • docs/benchmarks/prepared-diff-configuration-20261102.md and compressed lossless evidence retain sources, binary/fixture identities, drivers, raw samples, development failures and validation logs.
  • Per host: 42 native cases x three sessions; 32 in-memory whole-run cases x three sessions x two variants; six native controls x five confirmation sessions with a byte-identical baseline participant. Discarded warmups, nine rounds/repetitions and fastest-seven estimates remain separate contracts.
  • Native normalized 1,000-10,000-file pairs improve about 19% Linux / 6% macOS initially; final confirmation retains about 19-21% Linux / 4-6% macOS. The in-memory 10,000-entry normalized whole-run workload improves about 87% / 88%, including preparation/teardown.
  • Preserve costs: final confirmation includes Linux tiny listing +3.59% and macOS tiny listing +1.53%; the earlier prototype's Linux listing +3.67%, tiny plain diff +2.75% and macOS tiny plain diff +1.69% remain separately retained. The report includes duplicate-baseline values and all initial sessions. No universal CLI or first-startup speedup is claimed.
  • Unstripped CLI size increases 22,848 bytes on Linux and 1,552 bytes on macOS. Table storage scales with distinct action styles; regex backend bytes are not estimated as table capacity.
  • Requested worker counts do not imply concurrent diff actions; those remain ordered coordinator work. Linux native fixtures use tmpfs/affinity; macOS uses warm APFS without affinity. In-memory kernels are distinct from native command timings.

Validation:

  • Complete extension-enabled release suites: 321/321 on macOS and Linux, with required Linux FUSE mounts. An earlier lean run with ten skipped targets is retained separately.
  • Six focused ASan suites on each host and six focused Linux TSan suites pass. Final regression-test additions receive additional focused checks.
  • Direct regressions cover style deduplication/defaults, invalid normalization, no-consumer behavior, prepared/reference output/read counts, skipped reads, missing-style fallback, separate runs and pre-walk errors.
  • A genuine compile database was refreshed. All 33 affected translation units pass local lint (32 in the first full pass, then the benchmark source after trailing-comma corrections). A callback-complexity finding was fixed with a pure lookup helper; its final form was rebuilt and remeasured separately. Original prototype data and the first failed hook are retained. Normal enforcing commit/push hooks pass before this PR is created; final readiness depends on current pushed-head CI.

Base automatically changed from perf/reuse-default-catalogs to main November 2, 2026 13:53
@helly25
helly25 merged commit 00d4f84 into main Nov 2, 2026
32 checks passed
@helly25
helly25 deleted the perf/prepare-diff-configuration branch November 2, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant