Skip to content

feat(perf): standardize workload profiles and stabilize run policy - #16

Merged
wolfiesch merged 1 commit into
masterfrom
codex/2026-02-14-08-02-07-standardize-workload-sizes-for-adapters
Feb 14, 2026
Merged

feat(perf): standardize workload profiles and stabilize run policy#16
wolfiesch merged 1 commit into
masterfrom
codex/2026-02-14-08-02-07-standardize-workload-sizes-for-adapters

Conversation

@wolfiesch

@wolfiesch wolfiesch commented Feb 14, 2026

Copy link
Copy Markdown
Collaborator

Codex generated this pull request, but encountered an unexpected error after generation. This is a placeholder PR message.


Codex Task

Greptile Overview

Greptile Summary

Adds workload profiling and phase attribution to performance benchmarks. Introduces --iteration-policy CLI option (currently only supports "fixed"), classifies workloads into small/medium/large based on cell count, and tracks phase-level attribution (parse/write/verify) for operations.

Major changes:

  • New workload_size field on PerfFeatureResult with small/medium/large classification
  • New phase_attribution_ms field tracking parse/write/verify breakdown
  • Dashboard now includes "Best Adapter by Workload Profile" table showing optimal libraries per workload size
  • Iteration policy parameter threaded through CLI → runner → config → output
  • Comprehensive test coverage for new features

Issues found:

  • Critical bug in dashboard.py: duplicate table rows generated when no data exists
  • Minor style issue: unnecessary type check in cli.py

Confidence Score: 3/5

  • Cannot merge safely due to critical logic bug causing duplicate table rows
  • Solid implementation with good test coverage, but the dashboard table generation bug will produce malformed output when no performance data exists, breaking the dashboard display
  • Pay close attention to src/excelbench/results/dashboard.py - fix the duplicate row bug before merging

Important Files Changed

Filename Overview
src/excelbench/cli.py Added --iteration-policy CLI option with validation; minor style issue with redundant type check
src/excelbench/perf/renderer.py Added iteration_policy to markdown config output with safe default value
src/excelbench/perf/runner.py Implemented workload size classification, phase attribution tracking, and iteration policy validation
src/excelbench/results/dashboard.py Added workload profile table; critical bug causes duplicate table rows when no data exists
src/excelbench/results/html_dashboard.py Added iteration_policy to HTML dashboard metadata display
tests/test_dashboard.py New test validates workload profile table appears in dashboard output
tests/test_perf_cli.py Added assertion to verify iteration_policy is persisted in output JSON
tests/test_perf_workloads.py New test validates workload size classification and phase attribution metrics

Flowchart

flowchart TD
    A[CLI: perf command] -->|iteration_policy param| B[run_perf]
    B -->|validate policy| C{policy == 'fixed'?}
    C -->|no| D[ValueError]
    C -->|yes| E[Execute benchmarks]
    E -->|for each workload| F[_standardize_workload_size]
    F -->|count cells| G{Classify size}
    G -->|<= 1000| H[small]
    G -->|<= 10000| I[medium]
    G -->|> 10000| J[large]
    E -->|for each iteration| K[_measure_*_iteration]
    K -->|breakdown data| L[_phase_attribution_from_measurement]
    L -->|read op| M[parse + verify phases]
    L -->|write op| N[write phase]
    E -->|aggregate| O[PerfFeatureResult with workload_size + phase_attribution_ms]
    O -->|results| P[render_perf_results]
    P -->|generate| Q[Dashboard with workload profile table]
    Q -->|display| R[Best adapter by size]
Loading

Last reviewed commit: 4f6ab30

Copilot AI review requested due to automatic review settings February 14, 2026 08:02

@greptile-apps greptile-apps Bot left a comment

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.

8 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +319 to +322
if not has_any:
lines.append("| small | — | — |")
lines.append("| medium | — | — |")
lines.append("| large | — | — |")

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.

Table rows already added in loop (lines 310-317), causing duplicates when has_any=False

Suggested change
if not has_any:
lines.append("| small | — | — |")
lines.append("| medium | — | — |")
lines.append("| large | — | — |")
if not has_any:
return []
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/excelbench/results/dashboard.py
Line: 319:322

Comment:
Table rows already added in loop (lines 310-317), causing duplicates when `has_any=False`

```suggestion
    if not has_any:
        return []
```

How can I resolve this? If you propose a fix, please make it concise.

Comment thread src/excelbench/cli.py
Comment on lines +273 to +274
if not isinstance(iteration_policy, str):
iteration_policy = "fixed"

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.

Unnecessary type check - iteration_policy parameter has type annotation str in typer.Option, so will always be a string

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/excelbench/cli.py
Line: 273:274

Comment:
Unnecessary type check - `iteration_policy` parameter has type annotation `str` in typer.Option, so will always be a string

How can I resolve this? If you propose a fix, please make it concise.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4f6ab30379

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1061 to +1064
if workload is not None:
try:
op_count = len(_cells_from_range(str(workload["range"])))
except (TypeError, ValueError, KeyError):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Classify workload size using effective operation count

Workload size is derived from len(_cells_from_range(...)), but write workloads with op == "bulk_write_grid" can drastically reduce effective operations via sparse_every (see _bench_write_workload), so these runs are bucketed into the wrong size tier. This skews the new “Best Adapter by Workload Profile” aggregation because rates are computed from reduced op_count while size is computed from the full dense range.

Useful? React with 👍 / 👎.

Copilot AI left a comment

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.

Pull request overview

This PR enhances ExcelBench’s performance results by adding iteration policy metadata, standardizing workload size classification, capturing coarse phase attribution for perf operations, and expanding the combined dashboard to highlight best adapters per workload size.

Changes:

  • Add iteration_policy to perf configuration and surface it in CLI output, markdown, and HTML dashboards.
  • Add workload_size to perf result rows and compute it from workload ranges / test cases.
  • Add coarse phase_attribution_ms to perf op results, and add a dashboard section for “Best Adapter by Workload Profile”, with new tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/excelbench/perf/runner.py Adds iteration_policy, workload_size, phase_attribution_ms, and new helpers for workload sizing + phase attribution.
src/excelbench/cli.py Adds --iteration-policy flag and passes it through to run_perf.
src/excelbench/perf/renderer.py Includes iteration_policy in perf markdown output config line.
src/excelbench/results/html_dashboard.py Displays iteration_policy in the perf meta bar.
src/excelbench/results/dashboard.py Adds “Best Adapter by Workload Profile” section based on perf results.
tests/test_perf_cli.py Asserts iteration_policy is present in emitted perf metadata.
tests/test_perf_workloads.py Adds coverage for workload size standardization + phase attribution presence.
tests/test_dashboard.py Adds coverage for the new dashboard section rendering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1063 to +1065
op_count = len(_cells_from_range(str(workload["range"])))
except (TypeError, ValueError, KeyError):
op_count = 0

Copilot AI Feb 14, 2026

Copy link

Choose a reason for hiding this comment

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

_standardize_workload_size computes op_count via len(_cells_from_range(...)), which materializes a list of every cell address. For large ranges this adds significant CPU/memory overhead outside the timed benchmark. Consider computing the cell count from the start/end coords (rows*cols) without enumerating all cells, and when range parsing fails fall back to test_case count (or an explicit "unknown" size) instead of treating it as 0 (=> "small").

Suggested change
op_count = len(_cells_from_range(str(workload["range"])))
except (TypeError, ValueError, KeyError):
op_count = 0
range_str = str(workload["range"])
start_cell, end_cell = _split_range(range_str)
start_row, start_col = _cell_to_coord(start_cell)
end_row, end_col = _cell_to_coord(end_cell)
row_count = abs(end_row - start_row) + 1
col_count = abs(end_col - start_col) + 1
op_count = row_count * col_count
except (TypeError, ValueError, KeyError):
case_count = len(getattr(test_file, "test_cases", []) or [])
op_count = case_count

Copilot uses AI. Check for mistakes.
}

for entry in results:
size = str(entry.get("workload_size") or "small").strip().lower()

Copilot AI Feb 14, 2026

Copy link

Choose a reason for hiding this comment

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

Defaulting missing workload_size to "small" will misclassify older perf/results.json files (or other producers) that don't include this new field, which can make the "Best Adapter by Workload Profile" table misleading. Consider skipping entries without workload_size or inferring size from op_count/range/feature instead of forcing them into "small".

Suggested change
size = str(entry.get("workload_size") or "small").strip().lower()
raw_size = entry.get("workload_size")
if not raw_size:
# Skip entries without an explicit workload_size to avoid
# misclassifying older perf/results.json files.
continue
size = str(raw_size).strip().lower()

Copilot uses AI. Check for mistakes.
Comment on lines 74 to 84
def run_perf(
test_dir: Path,
*,
adapters: list[Any] | None = None,
features: list[str] | None = None,
profile: str = "xlsx",
warmup: int = 3,
iters: int = 25,
iteration_policy: str = "fixed",
breakdown: bool = False,
) -> PerfResults:

Copilot AI Feb 14, 2026

Copy link

Choose a reason for hiding this comment

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

The PR description is currently a placeholder and doesn’t describe the intended behavior/user impact of adding iteration_policy, workload_size, phase attribution, and the new dashboard section. Please update the PR description with a brief summary and any compatibility notes (e.g., how older perf results without workload_size are handled).

Copilot uses AI. Check for mistakes.
@wolfiesch wolfiesch changed the title Codex-generated pull request feat(perf): standardize workload profiles and stabilize run policy Feb 14, 2026
@wolfiesch
wolfiesch merged commit 68360f8 into master Feb 14, 2026
11 checks passed
@wolfiesch
wolfiesch deleted the codex/2026-02-14-08-02-07-standardize-workload-sizes-for-adapters branch February 14, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants