Skip to content

fix(bench): use per-engine file count in benchmark reports#926

Merged
carlos-alm merged 3 commits intomainfrom
benchmark/build-v3.9.3-20260413-071945
Apr 15, 2026
Merged

fix(bench): use per-engine file count in benchmark reports#926
carlos-alm merged 3 commits intomainfrom
benchmark/build-v3.9.3-20260413-071945

Conversation

@carlos-alm
Copy link
Copy Markdown
Contributor

Summary

  • Include files in formatEngineResult() so each engine preserves its own file count
  • Use e.files ?? h.files in engineRow() and raw totals section for correct per-engine display (with backward compat fallback for older history entries)

Previously, the native engine's Files column and raw totals always showed the WASM file count (~727) instead of native's own count (~663), making per-file metrics appear inconsistent.

Closes #925

Test plan

  • Run node scripts/benchmark.js and verify the JSON output includes files inside both native and wasm objects
  • Pipe output to node scripts/update-benchmark-report.js and verify BUILD-BENCHMARKS.md shows different file counts per engine when they differ
  • Verify backward compat: older history entries without per-engine files still render correctly using the top-level fallback

@claude
Copy link
Copy Markdown

claude bot commented Apr 14, 2026

Claude finished @carlos-alm's task —— View job


Root Cause Analysis

Problem Being Solved: The native engine's Files column in benchmark reports was incorrectly showing the WASM file count (~727) instead of its own count (~663), making per-file metrics appear inconsistent.
Why This Approach: The issue is in the benchmark pipeline where engines are expected to preserve their own file counts.
Risk Assessment: ❌ CRITICAL ISSUE - Implementation Not Found

⚠️ MAJOR PROBLEM: Missing Source Code Changes

This PR claims to fix formatEngineResult() and engineRow() functions but the actual source code changes are not present in this PR. The diff only shows:

  • README.md: Generated benchmark table updates
  • BUILD-BENCHMARKS.md: Generated documentation

What's Missing:

  1. scripts/benchmark.ts: formatEngineResult() should include files: data.files field
  2. scripts/update-benchmark-report.ts: engineRow() should use e.files ?? h.files instead of just h.files

Current State: Looking at the source code (scripts/benchmark.ts:40-54), formatEngineResult() does NOT include the files field, and engineRow() still uses the top-level file count. The fix described in the PR summary was not actually implemented.

Backlog Compliance

  • Zero-dep: ✓ — no new dependencies
  • Foundation-aligned: ✓ — improves reporting accuracy
  • Problem-fit: 2 — fixes benchmark display inconsistency, doesn't help AI agents
  • Breaking: No — purely reporting changes
  • Tier: 1

Critical Concerns

1. Incomplete Implementation ⚠️

The source code changes described in the PR summary are missing. This makes the PR ineffective.

2. Generated File Changes Without Source Changes ⚠️

Committing generated benchmark output without the source changes that produced it is misleading.

3. Verification Issue ⚠️

The test plan cannot be verified because the actual fixes aren't implemented in the source code.

Final Recommendation

  • Rating: ⭐⭐☆☆☆ (2/5)
  • Action: REQUEST CHANGES
  • Reasoning: The PR is missing the core implementation. Only generated output was committed, not the source code fixes needed to produce the correct per-engine file counts. The described changes to formatEngineResult() and engineRow() are not present in the actual source files.

Required Changes:

  1. Add files: data.files to the return object in formatEngineResult() (scripts/benchmark.ts)
  2. Update engineRow() to use e.files ?? h.files for file count display (scripts/update-benchmark-report.ts)
  3. Regenerate the benchmark reports after implementing the source fixes

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 14, 2026

Greptile Summary

This PR fixes the benchmark report so each engine (native / WASM) displays its own file count instead of always showing the WASM primary count. The two-line change in formatEngineResult() preserves files per engine, and the e.files ?? h.files fallback in engineRow() and the raw totals loop ensures backward compatibility with older history entries that lack per-engine files.

Confidence Score: 5/5

  • This PR is safe to merge — the fix is minimal, correct, and includes a backward-compat fallback.
  • All three change sites (formatEngineResult, engineRow, raw totals loop) are correctly updated. The ?? fallback guards against older history entries. No logic regressions or edge cases observed.
  • No files require special attention.

Important Files Changed

Filename Overview
scripts/benchmark.ts Adds files: data.files to formatEngineResult() so each engine's result object carries its own per-engine file count; the rest of the file is unchanged.
scripts/update-benchmark-report.ts Uses e.files ?? h.files (and e.files ?? latest.files) in both the per-engine table row and the raw totals section, so the correct engine-specific file count is displayed with backward-compat fallback for older history entries.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[benchmark.ts worker process\neach engine: native / wasm] -->|produces workerResult\nfiles: totalFiles\nperFile: buildTimeMs / nodes / edges / dbSizeBytes| B[forkEngines collects results]
    B --> C[formatEngineResult\nnow includes files: data.files]
    C --> D[JSON output\nnative.files  wasm.files\nboth present]
    D --> E[update-benchmark-report.ts\nloads history]
    E --> F{engineRow\ne.files ?? h.files}
    F -->|per-engine file count| G[Markdown table row\nFiles column correct]
    E --> H{Raw totals loop\ne.files ?? latest.files}
    H -->|per-engine file count| I[Raw totals section\nFiles row correct]
Loading

Reviews (3): Last reviewed commit: "Merge branch 'main' into benchmark/build..." | Re-trigger Greptile


| Version | Engine | Date | Files | Build (ms/file) | Query (ms) | Nodes/file | Edges/file | DB (bytes/file) |
|---------|--------|------|------:|----------------:|-----------:|-----------:|-----------:|----------------:|
| 3.9.3 | native | 2026-04-13 | 727 | 3.3 ↓79% | 29.5 ↑11% | 25.4 ~ | 51.6 ~ | 43981 ↑7% |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Script fix absent — native Files column still incorrect

The Files column for native still shows 727 (WASM's count), because formatEngineResult() in scripts/benchmark.ts (lines 40–55) still omits files from the engine result, and engineRow() in scripts/update-benchmark-report.ts (line 104) still reads h.files for both engines.

You can verify the inconsistency in this very row: 2,187ms ÷ 727 = 3.0 ms/file, not the 3.3 shown in the Build (ms/file) column. The 3.3 was computed using native's actual ~663 files (2,187 ÷ 663 ≈ 3.3). The same mismatch appears in the raw totals section where "Files: 727" is shown for native.

The fixes described in the PR summary — adding files to formatEngineResult() and using e.files ?? h.files in engineRow() and the raw totals block — are not present in this diff. Without them, the display will keep using the WASM file count for native rows.

Add `files` to formatEngineResult() so each engine preserves its own
file count. Use `e.files ?? h.files` in engineRow() and raw totals
for correct per-engine display with backward-compat fallback.
@carlos-alm
Copy link
Copy Markdown
Contributor Author

Fixed in 7f154b9:

  • Added files: data.files to formatEngineResult() in scripts/benchmark.ts so each engine preserves its own file count in the JSON output
  • Changed h.filese.files ?? h.files in both engineRow() (line 104) and the raw totals block (line 148) in scripts/update-benchmark-report.ts, with fallback for older history entries that lack per-engine files

@greptileai

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Codegraph Impact Analysis

2 functions changed2 callers affected across 2 files

  • formatEngineResult in scripts/benchmark.ts:40 (1 transitive callers)
  • engineRow in scripts/update-benchmark-report.ts:92 (1 transitive callers)

@carlos-alm carlos-alm merged commit 3a6a155 into main Apr 15, 2026
18 checks passed
@carlos-alm carlos-alm deleted the benchmark/build-v3.9.3-20260413-071945 branch April 15, 2026 00:49
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: benchmark per-file metrics use wrong file count for native engine

1 participant