Skip to content

Implement loop overhead cancellation #13

@pyk

Description

@pyk

I am concerned about the accuracy of benchmarks for extremely fast operations. The branching instructions in the for loop inside root.zig consume cycles that are currently included in the measurement.

nanobench handles this by running a calibration step. It measures an empty loop and subtracts that overhead from the final results.

It would be great to implement a similar calibration phase:

// measure empty loop cost
const overhead = try measureEmpty(batch_size);

// run actual benchmark
const total = try measureFn(batch_size);

// adjust result
const actual = total - overhead;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions