Skip to content

perf: avoid boxing provider futures for the default runtime - #290

Merged
baszalmstra merged 1 commit into
prefix-dev:mainfrom
baszalmstra:perf/private-immediate-queue
Aug 27, 2026
Merged

perf: avoid boxing provider futures for the default runtime#290
baszalmstra merged 1 commit into
prefix-dev:mainfrom
baszalmstra:perf/private-immediate-queue

Conversation

@baszalmstra

@baszalmstra baszalmstra commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

With the default NowOrNeverRuntime, provider futures resolve on their first poll, but the encoder still boxes every future before polling it. That pays an allocation even though these futures never need the pending queue.

This adds an internal queue mode. The default solver polls provider futures on the stack and stores ready results directly; solvers configured through with_runtime keep the existing boxed FuturesUnordered path, so custom runtimes that yield remain pending-capable without changing the public runtime contract.

Performance

On 2,000 fixed-seed fast-workload cases in four rotated slices against upstream main:

Upstream main This PR
Total 673.7s 650.9s (-3.39%)
Median 256.2ms 240.9ms
p95 808.0ms 781.2ms
Max 3708.2ms 3634.9ms

The CSV workloads and solve/unsat outcomes matched. A separate tracking-allocator check reduced allocation count by 15.54% and allocated bytes by 9.45%; peak live memory was unchanged.

Solve duration histogram

Per-problem duration difference

Testing

  • pixi run -e test-rust cargo fmt --check
  • pixi run -e test-rust cargo test --all-features

@baszalmstra
baszalmstra marked this pull request as ready for review August 27, 2026 07:45
@baszalmstra
baszalmstra force-pushed the perf/private-immediate-queue branch from b66a98a to f23c60a Compare August 27, 2026 07:45
@baszalmstra
baszalmstra enabled auto-merge (squash) August 27, 2026 07:46
@baszalmstra
baszalmstra merged commit e90f683 into prefix-dev:main Aug 27, 2026
9 checks passed
@baszalmstra
baszalmstra deleted the perf/private-immediate-queue branch August 27, 2026 07:48
@octo-sts octo-sts Bot mentioned this pull request Aug 27, 2026
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.

1 participant