Print out Wasm phase timings - #26
Conversation
📝 WalkthroughWalkthrough
ChangesWebAssembly timing collection
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant main
participant wasm_executable
participant run_benchmark
participant timing_table
main->>wasm_executable: check --benchmark-timings support
main->>run_benchmark: execute WebAssembly suite with timing collection
run_benchmark->>wasm_executable: pass --benchmark-timings
wasm_executable-->>run_benchmark: emit phase timing record
run_benchmark-->>timing_table: append parsed timing runs
main->>timing_table: compute and print phase statistics
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@run.py`:
- Around line 159-160: Update the collect_wasm_timings handling in run_benchmark
so parse_wasm_benchmark_timings failures are caught locally; retain the
benchmark result, emit a warning, and omit the timing row instead of propagating
the exception or aborting the suite. Keep successful timing rows unchanged and
preserve existing CalledProcessError behavior.
- Around line 104-106: Update supports_wasm_benchmark_timings to pass a finite
timeout to subprocess.run and treat subprocess.TimeoutExpired or a non-zero
return code as timings unavailable by returning False. Preserve the existing
stdout capability check for successful executions.
- Around line 286-288: Separate the scored benchmark invocation from the
timing-instrumented invocation in the executable flow: keep executable_arguments
unmodified for the run used to calculate ScoreMetric.time, and add
--benchmark-timings only to a distinct timing pass whose results populate the
timing report.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
af3179e to
f08af24
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@run.py`:
- Around line 127-131: Validate that record is a mapping/object before iterating
through WASM_BENCHMARK_PHASES and calling record.get. For non-object records,
follow the existing local handling that omits optional timings rather than
raising AttributeError; retain the current numeric-list validation for valid
mapping records.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| record = records[0] | ||
| for phase, _ in WASM_BENCHMARK_PHASES: | ||
| values = record.get(phase) | ||
| if not isinstance(values, list) or not all(isinstance(value, (int, float)) for value in values): | ||
| raise RuntimeError(f"Invalid Wasm benchmark timing values for {phase}") |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Reject non-object timing records before accessing .get().
Line 129 assumes the decoded JSON is a mapping. A list or scalar record raises AttributeError, bypasses the local handler, and aborts the suite instead of omitting optional timings.
Proposed fix
record = records[0]
+ if not isinstance(record, dict):
+ raise RuntimeError("Invalid Wasm benchmark timing record")
for phase, _ in WASM_BENCHMARK_PHASES:#!/bin/bash
python - <<'PY'
import json
for payload in ("[]", "null", '"timings"', "42"):
record = json.loads(payload)
print(payload, type(record).__name__, hasattr(record, "get"))
PY🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@run.py` around lines 127 - 131, Validate that record is a mapping/object
before iterating through WASM_BENCHMARK_PHASES and calling record.get. For
non-object records, follow the existing local handling that omits optional
timings rather than raising AttributeError; retain the current numeric-list
validation for valid mapping records.
Relies on LadybirdBrowser/ladybird#10934