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

Improve Benchmark Accuracy #2336

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

timcassell
Copy link
Collaborator

@timcassell timcassell commented Jun 21, 2023

Fixes #1133
Fixes #2305
Fixes #1802
Fixes #2530

  • Drastically simplified benchmark type code gen.
  • Overhead return type is always void for a fair baseline for all benchmark return types.
  • Benchmark method is called directly instead of wrapped in a delegate.
  • Return value is popped off the stack instead of passed to Consumer or a NoInlining method.
  • Added an assembly weaver that automatically applies MethodImplOptions.NoInlining to benchmark methods.
  • Added additional tests.

@timcassell

This comment was marked as outdated.

@timcassell timcassell force-pushed the fair-types branch 2 times, most recently from 48266cd to 4abbb1f Compare March 11, 2024 14:08
@timcassell timcassell modified the milestones: v0.14.0, v0.15.x Aug 6, 2024
@timcassell timcassell marked this pull request as draft January 13, 2025 00:58
@timcassell timcassell changed the title Fair Return Types Improve Benchmark Accuracy Feb 13, 2025
@timcassell timcassell marked this pull request as ready for review February 13, 2025 21:53
@timcassell
Copy link
Collaborator Author

timcassell commented Feb 13, 2025

Unfortunately, I no longer have an Intel CPU to test this, but I think the new results from this PR should address the issues you had in #2334 @AndreyAkinshin (results look good on my AMD 9800X3D CPU in .Net 8).

Reverted loop methods back to `AggressiveOptimization`.
Added `NoInlining` to `__Overhead` to match weaved benchmark method.
Updated ExpectedBenchmarkResultsTests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants