-
Notifications
You must be signed in to change notification settings - Fork 6
Benchmarks
Anton edited this page May 9, 2023
·
2 revisions
BenchmarkDotNet=v0.13.5, OS=Windows 10 (10.0.19045.2846/22H2/2022Update)
Intel Core i5-10400F CPU 2.90GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK=7.0.203
[Host] : .NET 6.0.16 (6.0.1623.17311), X64 RyuJIT AVX2
Job-ZILMVN : .NET 6.0.16 (6.0.1623.17311), X64 RyuJIT AVX2
Runtime=.NET 6.0
| Method | Mean | Error | StdDev | Gen0 | Allocated | Notes |
|---|---|---|---|---|---|---|
| New | 12.197 ns | 0.3053 ns | 0.3135 ns | 0.0076 | 48 B | Proxy of Activator |
| New1 | 17.950 ns | 0.3902 ns | 0.3650 ns | 0.0076 | 48 B | |
| New2 | 26.189 ns | 0.4290 ns | 0.3803 ns | 0.0076 | 48 B | |
| New3 | 30.655 ns | 0.3910 ns | 0.3466 ns | 0.0114 | 72 B | |
| Newargs | 14.466 ns | 0.3320 ns | 0.3409 ns | 0.0076 | 48 B | When arg types is unkown |
| New1args | 46.087 ns | 0.7669 ns | 0.8206 ns | 0.0166 | 104 B | When arg types is unkown |
| New2args | 67.974 ns | 0.7907 ns | 0.6173 ns | 0.0178 | 112 B | When arg types is unkown |
| New3args | 72.224 ns | 0.4556 ns | 0.3804 ns | 0.0229 | 144 B | When arg types is unkown |
| Activator | 9.882 ns | 0.2502 ns | 0.2340 ns | 0.0076 | 48 B | |
| Activator1 | 428.036 ns | 5.3699 ns | 4.7603 ns | 0.0777 | 488 B | |
| Activator2 | 503.348 ns | 7.6521 ns | 6.7834 ns | 0.0811 | 512 B | |
| Activator3 | 558.993 ns | 3.9958 ns | 3.5422 ns | 0.0896 | 568 B |
BenchmarkDotNet=v0.13.5, OS=Windows 10 (10.0.19045.2846/22H2/2022Update)
Intel Core i5-10400F CPU 2.90GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK=7.0.203
[Host] : .NET 6.0.16 (6.0.1623.17311), X64 RyuJIT AVX2
Job-XEOVBE : .NET 6.0.16 (6.0.1623.17311), X64 RyuJIT AVX2
Runtime=.NET 6.0
| Method | Mean | Error | StdDev | Gen0 | Allocated | Notes |
|---|---|---|---|---|---|---|
| PreKnowedTypesExpr | 7.140 ns | 0.1992 ns | 0.1863 ns | 0.0038 | 24 B | When class type and property type pre-knowed at compile time and cache is single-object |
| Reflection_GetProperty | 103.186 ns | 0.6418 ns | 0.5011 ns | 0.0038 | 24 B | |
| GetPropValue_objects | 17.372 ns | 0.1563 ns | 0.1220 ns | 0.0038 | 24 B | When return type and object type uknown (runtime) |
| GetPropValue_ReturnTypeKnown | 37.724 ns | 0.7981 ns | 1.0655 ns | 0.0191 | 120 B | When only return type is known |
| GetPropValue_HostTypeAndReturnTypeKnown | 40.142 ns | 0.8036 ns | 0.8252 ns | 0.0178 | 112 B | When return type and object type is known at compile time |
BenchmarkDotNet=v0.13.5, OS=Windows 10 (10.0.19045.2846/22H2/2022Update)
Intel Core i5-10400F CPU 2.90GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK=7.0.203
[Host] : .NET 6.0.16 (6.0.1623.17311), X64 RyuJIT AVX2
Job-SJRJSJ : .NET 6.0.16 (6.0.1623.17311), X64 RyuJIT AVX2
Runtime=.NET 6.0
| Method | Mean | Error | StdDev | Gen0 | Allocated | Notes |
|---|---|---|---|---|---|---|
| Reflection_SetProperty | 118.99 ns | 1.184 ns | 0.989 ns | 0.0038 | 24 B | |
| SetPropValue | 32.04 ns | 0.208 ns | 0.184 ns | 0.0204 | 128 B | |
| SetPropValueConverted | 55.55 ns | 1.113 ns | 1.093 ns | 0.0242 | 152 B | When value is another type of property and Convert.ChangeType called |
| SetPropValueEnumParse | 185.31 ns | 2.022 ns | 1.891 ns | 0.0241 | 152 B | When enum value setting in must be parsed with Enum.Parse method |
| SetPropValueNullable_Null | 35.29 ns | 0.298 ns | 0.249 ns | 0.0166 | 104 B | Setting nullable property of null
|
| SetPropValueNullable_Val | 43.68 ns | 0.275 ns | 0.215 ns | 0.0204 | 128 B | Setting nullable property of value |