Skip to content

fix: Throughput field names incorrectly labeled as megabits (mbps) instead of megabytes (mb_s) #112

@mcurrier2

Description

@mcurrier2

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_mbpsaverage_throughput_mb_s
  • peak_throughput_mbpspeak_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions