Skip to content

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 mentioned this pull request Feb 13, 2025
@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).

@timcassell timcassell marked this pull request as ready for review June 6, 2025 21:25
timcassell added 21 commits June 9, 2025 15:31
Overhead always returns `void`.
…thods.

Count down loops instead of count up.
Added IntroSmokeStringBuilder.
Added more return type test cases.
Reverted loop methods back to `AggressiveOptimization`.
Added `NoInlining` to `__Overhead` to match weaved benchmark method.
Updated ExpectedBenchmarkResultsTests.
Run task after CoreCompile instead of AfterBuild.
Don't fail silently.
Remove unused property.
Embed the weaver into BenchmarkDotNet.Annotations package instead of another package dependency.
@AndyAyersMS
Copy link
Member

@dotnet/jit-contrib any thoughts on this?

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