-
-
Notifications
You must be signed in to change notification settings - Fork 984
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
Performance changes when I use WithId #1342
Comments
From my experience (I am the person who was working on ensuring that the last few .NET Core releases have not regressed performance) such differences between benchmark runs are typically caused by memory and|or loop body alignment changes (which are quite random and can be caused by adding some additional source code). I am currently working on a Workshop for the .NET Team and preparing a doc that provides some examples and describes how to deal with that: https://github.com/adamsitnik/performance/blob/e4987916c83bef9c2203c256043dc4d9f6cc6a29/docs/regressions.md#memory-alignment I hope that this doc answers your question and provides you some way to move on from here (get the disassembly and compare alignment etc). Since there is nothing actionable on the BDN side and we already have two issues that track the alignment ideas (#756 and #1513) I am closing this one. The Thanks, |
Thanks, I think #1494 was what I was experiencing. I'll look into alignment issues, but I agree that is not a BDN problem. |
I've been investigating the performance of a benchmark i've created. I've been seeing a lot of weird behaviour, but I noticed one thing that appears to be specific to Benchmark.NET.
The following code demonstrates the problem: BorisTheBrave/DeBroglie@0b0f994
It runs a single test called
Benchmarks.Free
, under 3 different configurations:All three should logically give the same result, but instead, the unnamed one is significantly faster.
On my machine:
Default
is always under 5.7 ms, the others around 6ms. I get similar results in .NET Core 2.1.12.Running the jobs in separate processes separately doesn't change performance (so it's not a JIT warming thing).
Note that this behaviour is very sensitive to changes - I've found changing random unused lines of code, turning on debug symbols etc causes the Default to take 6ms instead. I presume that
WithId
is making some similar subtle difference to the compiled assembly. This makes it hard for me to supply you with a smaller test case.Using any
With
method seems to increase the runtime - I'm just illustrating withWithId
as it seems clear to me it shouldn't have any effect.In conclusion
Expected behaviour: Jobs
Default
andA
should have similar performanceActual behaviour:
Default
is significantly fasterSteps to reproduce: Checkout BorisTheBrave/DeBroglie@0b0f994, build DeBrogilie.Benchmark.exe and run it.
The text was updated successfully, but these errors were encountered: