Skip to content

Make mining benchmarks measure full nonce ranges - #99

Closed
n13 wants to merge 1 commit into
mainfrom
n13/realistic-benchmarks
Closed

n13 wants to merge 1 commit into
mainfrom
n13/realistic-benchmarks

Conversation

@n13

@n13 n13 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Overview

Mining throughput benchmarks could include context-construction overhead or stop early when a low-difficulty target produced a solution. This makes measured hash rates less representative of steady-state mining.

What changed

  • Use U512::MAX difficulty (target 1) for CLI, Criterion, and WGPU hashrate throughput measurements.
  • Build benchmark job contexts outside timed Criterion loops.
  • Make inclusive nonce ranges contain exactly their labeled count.
  • Remove the deliberately early-exit solution-finding case from the throughput suite.
  • Print the effective benchmark difficulty in CLI output.

Validation

  • cargo fmt --all -- --check
  • cargo clippy -p miner-cli -p engine-cpu -p engine-gpu --all-targets --locked -- -D warnings
  • cargo check -p engine-cpu --bench cpu_engine_bench --locked
  • cargo check -p engine-gpu --bench gpu_engine_bench --example hashrate --locked
  • cargo test -p miner-cli --locked
  • cargo run -p miner-cli --locked -- benchmark --cpu-workers 1 --gpu-devices 0 --duration 1

Risks and mitigations

The Criterion suite no longer measures solution-discovery latency. That case mixed variable early exits with throughput measurements; functional solution discovery remains covered by engine tests.

Follow-ups

None.

Use the maximum U512 difficulty for throughput measurements so solutions are effectively unreachable and each search processes its complete range. Prepare job contexts outside timed Criterion loops, use exact inclusive range sizes, and remove the early-exit solution-finding benchmark.
@n13

n13 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Don't need this!

@n13 n13 closed this Sep 10, 2026
@n13
n13 deleted the n13/realistic-benchmarks branch September 10, 2026 06:24
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