Skip to content

perf(amber): exit TrivialControlSpec receiveWhile early - #4506

Merged
Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:perf/trivial-control-spec
Apr 26, 2026
Merged

Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:perf/trivial-control-spec

Conversation

@Yicong-Huang

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

TrivialControlSpec.testControl used probe.receiveWhile(5.minutes, 10.seconds) with a catch-all case other => skip. Because the partial function always matched, receiveWhile could only exit via the 10s idle timeout — so every test sat idle for ~10s after collecting all expected returns. With 8 tests, that was ~80s of pure waiting.

Replace receiveWhile with a manual loop that exits as soon as flag == expectedValues.length. Behavior preserved: same per-message handling, same per-call 10s timeout (now via receiveOne), still throws AssertionError on timeout or wrong return values.

Any related issues, documentation, discussions?

Closes #4505

How was this PR tested?

Existing 8 tests in TrivialControlSpec all pass locally. Measured locally on the same worktree with a fresh sbt session:

Run completed in
before 1 minute, 11 seconds
after 1 second, 16 milliseconds

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7)

testControl used probe.receiveWhile(5.minutes, 10.seconds) with a
catch-all `case other => skip`. The partial function always matched,
so the loop only ever exited via the 10s idle timeout — every test
sat idle for ~10s after collecting all expected returns. With 8 tests
in the spec, that was ~80s of pure waiting.

Replace receiveWhile with a manual loop that exits as soon as
flag == expectedValues.length. Local timing: 1m 11s → 1s.

Closes apache#4505
@Yicong-Huang
Yicong-Huang requested a review from zuozhiw April 26, 2026 00:51

@zuozhiw zuozhiw 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.

looks good

@Yicong-Huang
Yicong-Huang merged commit 76480d9 into apache:main Apr 26, 2026
11 checks passed
@Yicong-Huang Yicong-Huang self-assigned this Apr 26, 2026
@Yicong-Huang
Yicong-Huang deleted the perf/trivial-control-spec branch June 15, 2026 06:46
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
### What changes were proposed in this PR?

`TrivialControlSpec.testControl` used `probe.receiveWhile(5.minutes,
10.seconds)` with a catch-all `case other => skip`. Because the partial
function always matched, `receiveWhile` could only exit via the 10s idle
timeout — so every test sat idle for ~10s after collecting all expected
returns. With 8 tests, that was ~80s of pure waiting.

Replace `receiveWhile` with a manual loop that exits as soon as `flag ==
expectedValues.length`. Behavior preserved: same per-message handling,
same per-call 10s timeout (now via `receiveOne`), still throws
`AssertionError` on timeout or wrong return values.

### Any related issues, documentation, discussions?

Closes apache#4505

### How was this PR tested?

Existing 8 tests in `TrivialControlSpec` all pass locally. Measured
locally on the same worktree with a fresh sbt session:

| | `Run completed in` |
|---|---|
| before | 1 minute, 11 seconds |
| after  | 1 second, 16 milliseconds |

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7)
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.

Optimize TrivialControlSpec test runtime

2 participants