Skip to content

perf: skip hashes for ineligible configuration stores - #103

Draft
yeahjack wants to merge 195 commits into
vladelaina:mainfrom
yeahjack:perf/config-hash-20261005
Draft

yeahjack wants to merge 195 commits into
vladelaina:mainfrom
yeahjack:perf/config-hash-20261005

Conversation

@yeahjack

@yeahjack yeahjack commented Oct 5, 2026 •

Copy link
Copy Markdown

Current-base specification disposition

Current main: 4283de1599c7da914138f82a99405d67c2c861ec. This PR remains Draft and is not applicable to that base.

  • Goal: skip configuration hashes only when their values cannot be consumed
  • Constraints: preserve current persistence policy, change detection, debounce, retries and serialization
  • Assessment: the current store implementation consumes both hashes on each eligible update, after its existing early-return guard. The secondary-pet and blocked-store branches targeted by this patch are no longer present
  • Non-goals: restoring removed store flags/policy or substituting an unrelated optimization
  • Acceptance outcome: the original optimization has no valid current-base target. No replacement implementation is proposed; the branch is retained as a draft reference

The implementation, validation and performance results below apply only to the historical 666999650f8afb405fa34dbf1ee0b98cd7145117 base. They are not claims about current main.

Summary

Move update-time configuration hashes inside their existing store-eligibility branches. This avoids computing hashes whose results cannot be used. Hash inputs, change detection, 300 ms debounce, 1 s retry, serialization, loading, and flush behavior are unchanged.

This is an independent change based on 666999650f8afb405fa34dbf1ee0b98cd7145117; it does not depend on the other performance PRs.

Correctness checks

  • Full Linux Release diagnostic-backend build, warnings as errors
  • All 6 CTests pass, including a new differential test against the frozen upstream implementation
  • 1,425 deterministic clock-driven steps, 260 save attempts, and 3,196,535 serialized JSON bytes compared exactly
  • Covers all eight secondary/settings-blocked/session-blocked combinations, defaults and full-capacity configurations, edits/reverts, exact debounce/retry boundaries, independent failures, validation changes, restored eligibility, flush, and mixed sequences
  • Focused ASan/UBSan passes; core/SDL archives were not instrumented and LeakSanitizer was disabled because the executor's ptrace prevents it
  • Repository line, localization, platform-runtime and Cubism-user-model checks pass

Measured component cost

GCC 14.2, -Os and native IPO/LTO, Debian 13 x86_64 cloud VM, Xeon Platinum 8573C, pinned logical CPU 0 (not a dedicated host). Old and new implementations use the same compiler and real production hash functions. Three independent runs each use warmup/calibration and 31 alternating paired samples, with at least a 30 ms calibration target per batch. Process CPU and monotonic wall time are recorded separately.

Pooled wall-time median / p95 of batch-average cost:

Scenario Before After
Saturated, session store blocked 616.932 / 1,046.383 µs 390.059 / 783.880 µs
Saturated, both stores blocked 233.395 µs median 4.478 ns median
Default, both stores blocked 344.644 ns median 4.460 ns median

The saturated session-blocked median falls by 36.77%; its three separate runs show 33.57–38.81% reductions. No allocation, cache, persistent field, or structure-size change is introduced.

Important limits: GCC already skips some unused settings hashing in the baseline. Healthy primary/secondary and settings-only-blocked controls show noisy results, including slower samples; this PR does not claim a common-path gain. The full raw data, control ranges, methodology and reproduction commands are in tests/runtime/README.md and tests/runtime/config_store_measurements.csv.

These are steady-state configuration-update microbenchmarks, not input-to-render latency, disk-save latency, FPS, or full-app CPU usage. Cubism SDK is absent, so full Live2D rendering was not built. Native window smoke is blocked by the cloud display-socket restriction; Windows/macOS results must come from CI and are not local runtime measurements.

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.

3 participants