Problem
The throughput fields in BenchmarkSummary and MechanismSummary are
named average_throughput_mbps and peak_throughput_mbps, which
conventionally means "megabits per second." However, the actual
calculation divides bytes_per_second by 1,000,000, producing
megabytes per second (MB/s).
The doc comments also say "megabits per second." The console output
correctly displays "MB/s" but the struct field names, doc comments,
and serialized JSON output are misleading.
There is a comment in the code acknowledging the mismatch:
// Note: The summary field is named _mbps, but the calculation
// in update_summary produces MB/s (Megabytes per second).
// The label reflects the calculation.
If the values were truly megabits per second, the calculation would
need to be bytes_per_second * 8 / 1_000_000. The current formula
produces megabytes per second.
Impact
- Anyone consuming the JSON output and trusting the field name
average_throughput_mbps would interpret the values as 8x smaller
than they actually are (1 byte = 8 bits).
- Doc comments are factually incorrect.
Fix
Rename the fields to match the actual unit:
average_throughput_mbps → average_throughput_mb_s
peak_throughput_mbps → peak_throughput_mb_s
- Update doc comments from "megabits" to "megabytes per second"
- Remove the workaround comments acknowledging the mismatch
Breaking Change
This renames fields in the serialized JSON output. Any downstream
tool parsing average_throughput_mbps from the JSON will need to
update to average_throughput_mb_s.
Files
src/results.rs — struct definitions, calculation, display, tests
src/results_blocking.rs — blocking equivalents
README.md — JSON example output
Problem
The throughput fields in
BenchmarkSummaryandMechanismSummaryarenamed
average_throughput_mbpsandpeak_throughput_mbps, whichconventionally means "megabits per second." However, the actual
calculation divides
bytes_per_secondby1,000,000, producingmegabytes per second (MB/s).
The doc comments also say "megabits per second." The console output
correctly displays "MB/s" but the struct field names, doc comments,
and serialized JSON output are misleading.
There is a comment in the code acknowledging the mismatch:
If the values were truly megabits per second, the calculation would
need to be
bytes_per_second * 8 / 1_000_000. The current formulaproduces megabytes per second.
Impact
average_throughput_mbpswould interpret the values as 8x smallerthan they actually are (1 byte = 8 bits).
Fix
Rename the fields to match the actual unit:
average_throughput_mbps→average_throughput_mb_speak_throughput_mbps→peak_throughput_mb_sBreaking Change
This renames fields in the serialized JSON output. Any downstream
tool parsing
average_throughput_mbpsfrom the JSON will need toupdate to
average_throughput_mb_s.Files
src/results.rs— struct definitions, calculation, display, testssrc/results_blocking.rs— blocking equivalentsREADME.md— JSON example output