Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Virtual getter for Benchmark.InnerIterationCount adds overhead #230

@AndyAyersMS

Description

@AndyAyersMS

The virtual call to Benchmark.get_InnerIterationCount can be on the same order of magnitude as simple operations one might like to time. Since the recommended usage is

            for (int i=0; i<Benchmark.InnerIterationCount; i++)
                // test code here

we are adding one virtual call's worth of overhead per inner iteration and all of this overhead gets timed.

Ideally the getter should be non-virtual. Marking BenchmarkIteratorImpl as final might also work in more recent builds as the getter should then devirtualize.

Alternatively, we should update the recommended usage to hoist the call out of the loop.

Metadata

Metadata

Assignees

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