-
Notifications
You must be signed in to change notification settings - Fork 0
TrustJIT_MyEmitDelegate
8bc5644787af489fccd4603c7dc4f0e5cdf80daf
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 invoke the method delegate. ILHook loads an extra reference.
Standard2 will call the method. ILHook loads an extra reference.
StandardStatic will call the static version of the method. ILHook do nothing.
this is (should be) CelesteTAS EmitStaticDelegate, or emit a static delegate.
StandardStaticAnd will call the static version of 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.0007 ns | 0.0000 ns |
| Standard | 33.3453 ns | 0.0384 ns | 0.0320 ns | 33.3307 ns |
| StandardStatic | 20.1886 ns | 0.0181 ns | 0.0160 ns | 20.1868 ns |
| StandardStaticAnd | 31.2268 ns | 0.0514 ns | 0.0481 ns | 31.2148 ns |
| Standard2 | 31.4145 ns | 0.0436 ns | 0.0408 ns | 31.4025 ns |
| Official | 33.3748 ns | 0.0841 ns | 0.0745 ns | 33.3396 ns |
| Mine | 32.9361 ns | 0.0280 ns | 0.0249 ns | 32.9239 ns |
| MineStatic | 21.9616 ns | 0.0286 ns | 0.0253 ns | 21.9654 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 (60.00%), N = 13, StdDev = 0.001 ns
Min = 0.000 ns, Q1 = 0.000 ns, Median = 0.000 ns, Q3 = 0.000 ns, Max = 0.002 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 (259.07% of Mean)
Skewness = 1.65, Kurtosis = 3.98, MValue = 2
-------------------- Histogram --------------------
[-0.000 ns ; 0.001 ns) | @@@@@@@@@@@
[ 0.001 ns ; 0.002 ns) |
[ 0.002 ns ; 0.002 ns) | @@
TrustJIT_MyEmitDelegate.Standard: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 33.345 ns, StdErr = 0.009 ns (0.03%), N = 13, StdDev = 0.032 ns
Min = 33.316 ns, Q1 = 33.322 ns, Median = 33.331 ns, Q3 = 33.356 ns, Max = 33.430 ns
IQR = 0.034 ns, LowerFence = 33.271 ns, UpperFence = 33.407 ns
ConfidenceInterval = [33.307 ns; 33.384 ns] (CI 99.9%), Margin = 0.038 ns (0.12% of Mean)
Skewness = 1.29, Kurtosis = 4, MValue = 2
-------------------- Histogram --------------------
[33.298 ns ; 33.448 ns) | @@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.StandardStatic: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 20.189 ns, StdErr = 0.004 ns (0.02%), N = 14, StdDev = 0.016 ns
Min = 20.160 ns, Q1 = 20.183 ns, Median = 20.187 ns, Q3 = 20.197 ns, Max = 20.216 ns
IQR = 0.014 ns, LowerFence = 20.161 ns, UpperFence = 20.219 ns
ConfidenceInterval = [20.171 ns; 20.207 ns] (CI 99.9%), Margin = 0.018 ns (0.09% of Mean)
Skewness = -0.01, Kurtosis = 2.05, MValue = 2
-------------------- Histogram --------------------
[20.151 ns ; 20.225 ns) | @@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.StandardStaticAnd: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 31.227 ns, StdErr = 0.012 ns (0.04%), N = 15, StdDev = 0.048 ns
Min = 31.160 ns, Q1 = 31.196 ns, Median = 31.215 ns, Q3 = 31.253 ns, Max = 31.331 ns
IQR = 0.057 ns, LowerFence = 31.110 ns, UpperFence = 31.339 ns
ConfidenceInterval = [31.175 ns; 31.278 ns] (CI 99.9%), Margin = 0.051 ns (0.16% of Mean)
Skewness = 0.5, Kurtosis = 2.25, MValue = 2
-------------------- Histogram --------------------
[31.134 ns ; 31.357 ns) | @@@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.Standard2: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 31.415 ns, StdErr = 0.011 ns (0.03%), N = 15, StdDev = 0.041 ns
Min = 31.365 ns, Q1 = 31.384 ns, Median = 31.402 ns, Q3 = 31.437 ns, Max = 31.495 ns
IQR = 0.053 ns, LowerFence = 31.305 ns, UpperFence = 31.517 ns
ConfidenceInterval = [31.371 ns; 31.458 ns] (CI 99.9%), Margin = 0.044 ns (0.14% of Mean)
Skewness = 0.61, Kurtosis = 2.01, MValue = 2
-------------------- Histogram --------------------
[31.343 ns ; 31.517 ns) | @@@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.Official: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 33.375 ns, StdErr = 0.020 ns (0.06%), N = 14, StdDev = 0.075 ns
Min = 33.296 ns, Q1 = 33.324 ns, Median = 33.340 ns, Q3 = 33.403 ns, Max = 33.556 ns
IQR = 0.079 ns, LowerFence = 33.206 ns, UpperFence = 33.521 ns
ConfidenceInterval = [33.291 ns; 33.459 ns] (CI 99.9%), Margin = 0.084 ns (0.25% of Mean)
Skewness = 1.13, Kurtosis = 3.11, MValue = 2
-------------------- Histogram --------------------
[33.255 ns ; 33.597 ns) | @@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.Mine: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 32.936 ns, StdErr = 0.007 ns (0.02%), N = 14, StdDev = 0.025 ns
Min = 32.911 ns, Q1 = 32.919 ns, Median = 32.924 ns, Q3 = 32.946 ns, Max = 32.989 ns
IQR = 0.027 ns, LowerFence = 32.878 ns, UpperFence = 32.986 ns
ConfidenceInterval = [32.908 ns; 32.964 ns] (CI 99.9%), Margin = 0.028 ns (0.09% of Mean)
Skewness = 0.86, Kurtosis = 2.34, MValue = 2
-------------------- Histogram --------------------
[32.897 ns ; 33.003 ns) | @@@@@@@@@@@@@@
TrustJIT_MyEmitDelegate.MineStatic: DefaultJob
Runtime = .NET 9.0.3 (9.0.325.11113), X64 RyuJIT AVX2; GC = Concurrent Workstation
Mean = 21.962 ns, StdErr = 0.007 ns (0.03%), N = 14, StdDev = 0.025 ns
Min = 21.900 ns, Q1 = 21.948 ns, Median = 21.965 ns, Q3 = 21.975 ns, Max = 22.002 ns
IQR = 0.026 ns, LowerFence = 21.909 ns, UpperFence = 22.014 ns
ConfidenceInterval = [21.933 ns; 21.990 ns] (CI 99.9%), Margin = 0.029 ns (0.13% of Mean)
Skewness = -0.7, Kurtosis = 3.33, MValue = 2
-------------------- Histogram --------------------
[21.886 ns ; 22.016 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.0007 ns | 0.0000 ns |
| Standard | 33.3453 ns | 0.0384 ns | 0.0320 ns | 33.3307 ns |
| StandardStatic | 20.1886 ns | 0.0181 ns | 0.0160 ns | 20.1868 ns |
| StandardStaticAnd | 31.2268 ns | 0.0514 ns | 0.0481 ns | 31.2148 ns |
| Standard2 | 31.4145 ns | 0.0436 ns | 0.0408 ns | 31.4025 ns |
| Official | 33.3748 ns | 0.0841 ns | 0.0745 ns | 33.3396 ns |
| Mine | 32.9361 ns | 0.0280 ns | 0.0249 ns | 32.9239 ns |
| MineStatic | 21.9616 ns | 0.0286 ns | 0.0253 ns | 21.9654 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.69 ns)
TrustJIT_MyEmitDelegate.Standard: Default -> 2 outliers were removed (35.18 ns, 35.22 ns)
TrustJIT_MyEmitDelegate.StandardStatic: Default -> 1 outlier was removed (21.97 ns)
TrustJIT_MyEmitDelegate.Official: Default -> 1 outlier was removed (35.31 ns)
TrustJIT_MyEmitDelegate.Mine: Default -> 1 outlier was removed (35.35 ns)
TrustJIT_MyEmitDelegate.MineStatic: Default -> 1 outlier was removed, 2 outliers were detected (23.57 ns, 23.74 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)