-
Notifications
You must be signed in to change notification settings - Fork 0
TrustJIT_MyEmitDelegate
Come on, tell me.
What do you desire?
All benchmarks is complicated.
All methods is ILHooked.
Official is the official EmitDelegate.
MineStatic is to test what i found. it's a new way to emit delegate. (store all existing stack values to local variables, ldnull, load them back, call the method, and trust jit)
Mine is the delegate variant of MineStatic, to test what if the delegate can't be static.
Standard* emit the delegate ahead-of-time.
Standard will call the method delegate. ILHook loads an extra reference.
StandardStatic will call the static version of the method. ILHook do nothing. this is (should be) CelesteTAS EmitStaticDelegate.
Standard2 will call the method. ILHook loads an extra reference.
BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.202
[Host] : .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2
DefaultJob : .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2
| Method | Mean | Error | StdDev | Median |
|---|---|---|---|---|
| Padding | 0.0003 ns | 0.0009 ns | 0.0008 ns | 0.0000 ns |
| Standard | 33.3474 ns | 0.0709 ns | 0.0664 ns | 33.3271 ns |
| StandardStatic | 19.8706 ns | 0.0284 ns | 0.0237 ns | 19.8727 ns |
| Standard2 | 31.0350 ns | 0.0512 ns | 0.0453 ns | 31.0368 ns |
| Official | 32.6913 ns | 0.0518 ns | 0.0485 ns | 32.6909 ns |
| Mine | 32.3723 ns | 0.0242 ns | 0.0214 ns | 32.3670 ns |
| MineStatic | 21.9291 ns | 0.0195 ns | 0.0173 ns | 21.9261 ns |
// * Detailed results *
TrustJIT_MyEmitDelegate.Padding: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 0.000 ns, StdErr = 0.000 ns (75.36%), N = 13, StdDev = 0.001 ns
Min = 0.000 ns, Q1 = 0.000 ns, Median = 0.000 ns, Q3 = 0.000 ns, Max = 0.003 ns
IQR = 0.000 ns, LowerFence = 0.000 ns, UpperFence = 0.000 ns
ConfidenceInterval = [-0.001 ns; 0.001 ns] (CI 99.9%), Margin = 0.001 ns (325.38% of Mean)
Skewness = 2.32, Kurtosis = 7.18, MValue = 2
-------------------- Histogram --------------------
[-0.001 ns ; 0.000 ns) | @@@@@@@@@@@
[ 0.000 ns ; 0.001 ns) | @
[ 0.001 ns ; 0.002 ns) |
[ 0.002 ns ; 0.003 ns) | @
TrustJIT_MyEmitDelegate.Standard: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 33.347 ns, StdErr = 0.017 ns (0.05%), N = 15, StdDev = 0.066 ns
Min = 33.269 ns, Q1 = 33.304 ns, Median = 33.327 ns, Q3 = 33.389 ns, Max = 33.466 ns
IQR = 0.085 ns, LowerFence = 33.176 ns, UpperFence = 33.517 ns
ConfidenceInterval = [33.276 ns; 33.418 ns] (CI 99.9%), Margin = 0.071 ns (0.21% of Mean)
Skewness = 0.68, Kurtosis = 1.82, MValue = 2
-------------------- Histogram --------------------
[33.233 ns ; 33.502 ns) | @@@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.StandardStatic: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 19.871 ns, StdErr = 0.007 ns (0.03%), N = 13, StdDev = 0.024 ns
Min = 19.818 ns, Q1 = 19.855 ns, Median = 19.873 ns, Q3 = 19.893 ns, Max = 19.902 ns
IQR = 0.039 ns, LowerFence = 19.797 ns, UpperFence = 19.951 ns
ConfidenceInterval = [19.842 ns; 19.899 ns] (CI 99.9%), Margin = 0.028 ns (0.14% of Mean)
Skewness = -0.5, Kurtosis = 2.5, MValue = 2
-------------------- Histogram --------------------
[19.804 ns ; 19.915 ns) | @@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.Standard2: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 31.035 ns, StdErr = 0.012 ns (0.04%), N = 14, StdDev = 0.045 ns
Min = 30.951 ns, Q1 = 31.005 ns, Median = 31.037 ns, Q3 = 31.074 ns, Max = 31.106 ns
IQR = 0.069 ns, LowerFence = 30.902 ns, UpperFence = 31.177 ns
ConfidenceInterval = [30.984 ns; 31.086 ns] (CI 99.9%), Margin = 0.051 ns (0.16% of Mean)
Skewness = -0.07, Kurtosis = 1.81, MValue = 2
-------------------- Histogram --------------------
[30.926 ns ; 31.131 ns) | @@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.Official: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 32.691 ns, StdErr = 0.013 ns (0.04%), N = 15, StdDev = 0.048 ns
Min = 32.615 ns, Q1 = 32.656 ns, Median = 32.691 ns, Q3 = 32.730 ns, Max = 32.769 ns
IQR = 0.074 ns, LowerFence = 32.545 ns, UpperFence = 32.841 ns
ConfidenceInterval = [32.639 ns; 32.743 ns] (CI 99.9%), Margin = 0.052 ns (0.16% of Mean)
Skewness = 0.05, Kurtosis = 1.54, MValue = 2
-------------------- Histogram --------------------
[32.589 ns ; 32.795 ns) | @@@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.Mine: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 32.372 ns, StdErr = 0.006 ns (0.02%), N = 14, StdDev = 0.021 ns
Min = 32.343 ns, Q1 = 32.357 ns, Median = 32.367 ns, Q3 = 32.387 ns, Max = 32.415 ns
IQR = 0.030 ns, LowerFence = 32.312 ns, UpperFence = 32.433 ns
ConfidenceInterval = [32.348 ns; 32.396 ns] (CI 99.9%), Margin = 0.024 ns (0.07% of Mean)
Skewness = 0.35, Kurtosis = 1.83, MValue = 2
-------------------- Histogram --------------------
[32.331 ns ; 32.426 ns) | @@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.MineStatic: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 21.929 ns, StdErr = 0.005 ns (0.02%), N = 14, StdDev = 0.017 ns
Min = 21.910 ns, Q1 = 21.915 ns, Median = 21.926 ns, Q3 = 21.940 ns, Max = 21.966 ns
IQR = 0.025 ns, LowerFence = 21.877 ns, UpperFence = 21.978 ns
ConfidenceInterval = [21.910 ns; 21.949 ns] (CI 99.9%), Margin = 0.020 ns (0.09% of Mean)
Skewness = 0.65, Kurtosis = 2.15, MValue = 2
-------------------- Histogram --------------------
[21.900 ns ; 21.976 ns) | @@@@@@@@@@@@@@
// * Summary *
BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.202
[Host] : .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2
DefaultJob : .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2
| Method | Mean | Error | StdDev | Median |
|--------------- |-----------:|----------:|----------:|-----------:|
| Padding | 0.0003 ns | 0.0009 ns | 0.0008 ns | 0.0000 ns |
| Standard | 33.3474 ns | 0.0709 ns | 0.0664 ns | 33.3271 ns |
| StandardStatic | 19.8706 ns | 0.0284 ns | 0.0237 ns | 19.8727 ns |
| Standard2 | 31.0350 ns | 0.0512 ns | 0.0453 ns | 31.0368 ns |
| Official | 32.6913 ns | 0.0518 ns | 0.0485 ns | 32.6909 ns |
| Mine | 32.3723 ns | 0.0242 ns | 0.0214 ns | 32.3670 ns |
| MineStatic | 21.9291 ns | 0.0195 ns | 0.0173 ns | 21.9261 ns |
// * Warnings *
ZeroMeasurement
TrustJIT_MyEmitDelegate.Padding: Default -> The method duration is indistinguishable from the empty method duration
// * Hints *
Outliers
TrustJIT_MyEmitDelegate.Padding: Default -> 2 outliers were removed (1.68 ns, 1.68 ns)
TrustJIT_MyEmitDelegate.StandardStatic: Default -> 2 outliers were removed (21.69 ns, 21.71 ns)
TrustJIT_MyEmitDelegate.Standard2: Default -> 1 outlier was removed (33.26 ns)
TrustJIT_MyEmitDelegate.Mine: Default -> 1 outlier was removed (34.13 ns)
TrustJIT_MyEmitDelegate.MineStatic: Default -> 1 outlier was removed (23.83 ns)
// * Legends *
Mean : Arithmetic mean of all measurements
Error : Half of 99.9% confidence interval
StdDev : Standard deviation of all measurements
Median : Value separating the higher half of all measurements (50th percentile)
1 ns : 1 Nanosecond (0.000000001 sec)