Use IL shuffle thunk on all platforms#131303
Closed
huoyaoyuan wants to merge 2 commits into
Closed
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke |
Member
Author
|
@EgorBot -intel -amd -arm64 using System;
using BenchmarkDotNet.Attributes;
namespace BenchmarkGround
{
public struct GCStruct
{
public object a, b, c, d, e, f, h, g;
}
public class Bench
{
private readonly object obj = new object();
private readonly Guid guid = Guid.NewGuid();
private readonly GCStruct gcStruct = new GCStruct
{
a = new object(),
g = new object()
};
private Action<int> singleArg = SingleArg_Static;
public static void SingleArg_Static(int a) { }
private Func<int, double, Guid, GCStruct, object, double> manyArg_RetFPU = ManyArg_RetFPU_Static;
public static double ManyArg_RetFPU_Static(int a, double b, Guid c, GCStruct d, object e) => 1.0;
[Benchmark]
public void SingleArg() => singleArg(0);
[Benchmark]
public double ManyArg_RetFPU() => manyArg_RetFPU(1, 2.0, guid, gcStruct, obj);
}
} |
Member
Author
|
The initiative is getting such unbelievable benchmark result locally:
The 90ns result also reproduces with 10.0.10. It only reproduces on Windows. Even for 7 args on Linux, the time is still <3ns. |
Member
Author
|
@EgorBot -windows_x64 -linux_x64 -arm64 using System;
using BenchmarkDotNet.Attributes;
namespace BenchmarkGround
{
public struct GCStruct
{
public object a, b, c, d, e, f, h, g;
}
public class Bench
{
private readonly object obj = new object();
private readonly Guid guid = Guid.NewGuid();
private readonly GCStruct gcStruct = new GCStruct
{
a = new object(),
g = new object()
};
private Action<int> singleArg = SingleArg_Static;
public static void SingleArg_Static(int a) { }
private Func<int, double, Guid, GCStruct, object, double> manyArg_RetFPU = ManyArg_RetFPU_Static;
public static double ManyArg_RetFPU_Static(int a, double b, Guid c, GCStruct d, object e) => 1.0;
private Func<int, double, Guid, GCStruct, object, Int128, UInt128, double> moreArg_RetFPU = MoreArg_RetFPU_Static;
public static double MoreArg_RetFPU_Static(int a, double b, Guid c, GCStruct d, object e, Int128 f, UInt128 g) => 1.0;
[Benchmark]
public void SingleArg() => singleArg(0);
[Benchmark]
public double ManyArg_RetFPU() => manyArg_RetFPU(1, 2.0, guid, gcStruct, obj);
[Benchmark]
public double MoreArg_RetFPU() => moreArg_RetFPU(1, 2.0, guid, gcStruct, obj, 0, 0);
}
} |
Member
Author
|
Closing as problem in both tests and performance. Still curious why the 90ns case happens on local Windows. |
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Open early to see the benchmark and tests.