Skip to content

3.1 capture hot-path perf baseline (Phase 2 opener)#39

Merged
fernandoxavier02 merged 1 commit intorefactor/skill-advisor-0.5.0from
claude/enable-auto-mode-RLyuW
Apr 27, 2026
Merged

3.1 capture hot-path perf baseline (Phase 2 opener)#39
fernandoxavier02 merged 1 commit intorefactor/skill-advisor-0.5.0from
claude/enable-auto-mode-RLyuW

Conversation

@fernandoxavier02
Copy link
Copy Markdown
Owner

Summary

Slice 3.1 of the skill-advisor 0.5.0 refactor — Phase 2 (Hot-Path) opener. Captures p50/p95/mean wall-clock for hooks/advisor-nudge.cjs as it stands today (pre-3.3 core extraction). Locks the baseline that slice 3.7 will assert against: p95_atual ≤ baseline.p95 × 1.10.

Capture-only — no asserts in this slice (per spec).

What ships

  • tests/_perf-capture.js — rerunnable subprocess-spawn baseline harness. Leading _ keeps it out of node --test tests/*.test.js. Re-run with node tests/_perf-capture.js to refresh the baseline JSON.
  • tests/fixtures/perf-baseline.json — schema-versioned baseline with runtime + environment metadata (node version, platform, index entry count, embeddings/graph availability) so 3.7 can verify same-conditions replay.

Methodology

Choice Rationale
spawnSync per iteration Production-faithful — Claude Code invokes the hook as a child process. Includes Node startup, file IO, and full hot-path code.
80-char + 500-char prompts Typical (short) and long-tail (mixed PT-BR/EN to exercise tokenizer + synonym expansion).
8 warmup iterations discarded Avoids JIT cold-start bias + warms FS cache (per Phase 0 reviewer recommendation).
100 sampled iterations Per-prompt sample size, matches _perf-harness.js default.
ADVISOR_ENABLED=true env override Bypasses advisor-config.json enabled: false default without mutating the config file.

Captured baseline (this run)

Sample p50 p95 mean
short (80c) 35.16 ms 39.59 ms 35.57 ms
long (500c) 37.59 ms 42.64 ms 38.25 ms

Environment: Node v22.22.2 / linux x64, 1 indexed entry, graph available, embeddings unavailable. Slice 3.7 must replay under same npm run index conditions for an apples-to-apples comparison.

Test plan

  • npm ci
  • npm run index (1 entry indexed — deterministic on this host)
  • node tests/_perf-capture.js produces tests/fixtures/perf-baseline.json
  • npm run validate — 681/681 tests pass, smoke-runner exits 0
  • Adversarial review (slice review per Phase 2 plan)
  • Slice 3.7 will add the headroom assertion test against this baseline

Requirements: 4.2


Generated by Claude Code

Slice 3.1 — Phase 2 (Hot-Path) opener. Captures p50/p95/mean wall-clock
for hooks/advisor-nudge.cjs as it stands today, before the 3.3 core
extraction. Locks the baseline that 3.7 will assert against
(p95_atual <= baseline.p95 * 1.10).

Methodology:
- subprocess spawnSync per iteration (production-faithful — Claude Code
  invokes the hook as a child process)
- 80-char and 500-char prompt corpora (PT-BR + EN tokens for 500-char
  to exercise tokenizer + synonym expansion)
- 8 warmup iterations discarded per prompt (JIT + FS cache)
- 100 sampled iterations per prompt
- ADVISOR_ENABLED=true env override; advisor-config.json untouched

No asserts in this slice — capture only. Baseline JSON includes
runtime/environment metadata (node version, platform, index entry count,
embeddings/graph availability) so 3.7 can verify same-conditions replay.

tests/_perf-capture.js is rerunnable: \`node tests/_perf-capture.js\`
refreshes tests/fixtures/perf-baseline.json. Leading underscore keeps
it out of \`node --test tests/*.test.js\`.

_Requirements: 4.2_
@fernandoxavier02 fernandoxavier02 merged commit 580ef16 into refactor/skill-advisor-0.5.0 Apr 27, 2026
5 checks passed
Copy link
Copy Markdown
Owner Author

Closing — fast-forwarded 580ef16 (slice 3.1) directly onto refactor/skill-advisor-0.5.0, which is where the refactor work belongs per the original session plan. The Claude Code web harness routed me onto the claude/enable-auto-mode-RLyuW side branch by default; reverting that to match the spec workflow. No code changes lost, no force push.


Generated by Claude Code

@fernandoxavier02 fernandoxavier02 deleted the claude/enable-auto-mode-RLyuW branch April 27, 2026 20: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.

2 participants