Skip to content

Can the allocator passed to init() be used to track allocations of tests? #109

@inge4pres

Description

@inge4pres

Thanks for making zBench! 🙏🏼

While exploring the library for the first time, I noticed that tracking allocation is possible only by making the code under test consume the allocator passed to run().

I can imagine why this is designed this way, and I was curious to know if you think it poses a limitation.

What is the suggested approach to benchmark a specific function/method that does not consume an allocator directly, but rather inherits the allocator from a struct?
As a reference, in this benchmark test I would like only to record allocations for the histogram.record() method call.
The problem is, record() does not accept an allocator, so apparently I am have to run the entire setup in the benchmarks too.

Is there a better way?

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