Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if IterationSetup is provided, and InvocationCount and UnrollFactor are not, run benchmark once per iteration to avoid user confusion #764

Merged
merged 1 commit into from
May 28, 2018

Conversation

adamsitnik
Copy link
Member

fixes #730

Example:

public class FileSample
{
    private readonly string filePath = Path.GetTempFileName();

    [IterationSetup]
    public void Create()
    {
        using (File.Create(filePath)) { }
    }

    [Benchmark]
    public void Remove() => File.Delete(filePath);
}

/cc @stephentoub @nietras

…re not, run benchmark once per iteration to avoid user confusion, fixes #730
@adamsitnik
Copy link
Member Author

@AndreyAkinshin The histogram for my example looks really nice!

-------------------- Histogram --------------------
[0.979 ms ; 1.701 ms) | @@@
[1.701 ms ; 2.227 ms) | @@@@
[2.227 ms ; 2.573 ms) |
[2.573 ms ; 3.064 ms) | @@@@@@@@@@@@@
[3.064 ms ; 3.590 ms) | @@@@@@@@@@@@@@@@@@@@@@@@
[3.590 ms ; 4.186 ms) | @@@@@@
[4.186 ms ; 4.776 ms) | @@@@
[4.776 ms ; 5.470 ms) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[5.470 ms ; 5.989 ms) | @@@@@
[5.989 ms ; 6.424 ms) | @@
[6.424 ms ; 6.689 ms) |
[6.689 ms ; 7.215 ms) | @@@@
[7.215 ms ; 7.826 ms) | @
---------------------------------------------------

And I got nice multimodal warning:

MultimodalDistribution
  FileSample.Remove: InvocationCount=1, UnrollFactor=1 -> It seems that the distribution is bimodal (mValue = 3,86666666666667)

Copy link
Member

@AndreyAkinshin AndreyAkinshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IterationSetup is not running before each benchmark invocation
2 participants