Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional reflection invoke benchmarks #4588

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

steveharter
Copy link
Member

Add benchmarks for the MethodInvoker and ConstructorInvoker classes and for an additional case of re-invoking the constructor on an existing object.

These will help verify upcoming changes with startup performance optimizations.

FWIW here's my local results

Method Mean Error StdDev Median Min Max Gen0 Allocated
Method0_NoParms 9.256 ns 0.2306 ns 0.2467 ns 9.321 ns 8.936 ns 9.687 ns - -
Method0_NoParms_MethodInvoker 5.086 ns 0.0845 ns 0.0790 ns 5.086 ns 4.974 ns 5.210 ns - -
StaticMethod4_arrayNotCached_int_string_struct_class 36.719 ns 0.8800 ns 0.9416 ns 36.756 ns 35.018 ns 38.944 ns 0.0099 104 B
StaticMethod5_arrayNotCached_int_string_struct_class_bool 53.684 ns 1.7858 ns 1.9108 ns 53.373 ns 51.268 ns 58.168 ns 0.0128 136 B
StaticMethod4_int_string_struct_class 27.268 ns 0.2212 ns 0.1961 ns 27.250 ns 26.996 ns 27.705 ns - -
StaticMethod4_int_string_struct_class_MethodInvoker 11.969 ns 0.1103 ns 0.1032 ns 11.948 ns 11.818 ns 12.189 ns - -
StaticMethod4_int_string_struct_class_MethodInvokerWithSpan 13.495 ns 0.2373 ns 0.2220 ns 13.476 ns 13.170 ns 13.917 ns - -
StaticMethod4_ByRefParams_int_string_struct_class 109.117 ns 1.5282 ns 1.4295 ns 108.865 ns 107.082 ns 112.330 ns 0.0043 48 B
StaticMethod4_ByRefParams_int_string_struct_class_MethodInvoker 89.722 ns 2.2954 ns 2.6434 ns 89.848 ns 85.623 ns 95.046 ns 0.0045 48 B
StaticMethod5_ByRefParams_int_string_struct_class_bool 146.748 ns 2.9333 ns 3.2604 ns 145.738 ns 143.107 ns 153.888 ns 0.0069 72 B
Ctor0_NoParams 11.067 ns 1.8132 ns 2.0154 ns 10.683 ns 8.790 ns 14.236 ns 0.0061 64 B
Ctor0_NoParams_ConstructorInvoker 7.392 ns 0.3309 ns 0.3810 ns 7.311 ns 6.822 ns 8.014 ns 0.0061 64 B
Ctor0_NoParams_Reinvoke 36.917 ns 0.3275 ns 0.2903 ns 36.811 ns 36.529 ns 37.523 ns - -
Ctor0_ActivatorCreateInstance_NoParams 6.424 ns 0.1279 ns 0.1422 ns 6.430 ns 6.182 ns 6.656 ns 0.0061 64 B
Ctor4_int_string_struct_class 29.025 ns 0.3752 ns 0.3509 ns 28.938 ns 28.516 ns 29.798 ns 0.0061 64 B
Ctor4_int_string_struct_class_ConstructorInvoker 15.152 ns 0.2552 ns 0.2262 ns 15.198 ns 14.776 ns 15.476 ns 0.0061 64 B
Ctor4_ActivatorCreateInstance 253.183 ns 2.7633 ns 2.3075 ns 252.531 ns 249.825 ns 257.579 ns 0.0403 432 B
Property_Get_int 13.426 ns 0.5590 ns 0.6437 ns 13.143 ns 12.658 ns 14.572 ns 0.0023 24 B
Property_Get_class 9.814 ns 0.1697 ns 0.1588 ns 9.786 ns 9.610 ns 10.099 ns - -
Property_Set_int 16.034 ns 0.6744 ns 0.7495 ns 15.819 ns 15.254 ns 17.719 ns 0.0023 24 B
Property_Set_class 11.953 ns 0.1426 ns 0.1334 ns 11.979 ns 11.715 ns 12.144 ns - -
Field_Get_int 29.956 ns 0.5819 ns 0.5715 ns 29.757 ns 29.286 ns 31.119 ns 0.0022 24 B
Field_GetStatic_int 25.167 ns 0.2868 ns 0.2542 ns 25.096 ns 24.840 ns 25.739 ns 0.0022 24 B
Field_Get_class 3.576 ns 0.0451 ns 0.0377 ns 3.562 ns 3.539 ns 3.658 ns - -
Field_GetStatic_class 2.521 ns 0.0228 ns 0.0214 ns 2.521 ns 2.496 ns 2.564 ns - -
Field_Get_struct 27.129 ns 0.3876 ns 0.3626 ns 26.995 ns 26.675 ns 27.800 ns 0.0022 24 B
Field_GetStatic_struct 26.800 ns 0.3545 ns 0.3316 ns 26.802 ns 26.309 ns 27.457 ns 0.0022 24 B
Field_Set_int 8.713 ns 0.2312 ns 0.2662 ns 8.653 ns 8.380 ns 9.198 ns 0.0023 24 B
Field_SetStatic_int 7.650 ns 0.3617 ns 0.4020 ns 7.482 ns 7.145 ns 8.513 ns 0.0023 24 B
Field_Set_class 16.352 ns 0.3568 ns 0.3966 ns 16.211 ns 15.759 ns 17.135 ns 0.0023 24 B
Field_SetStatic_class 15.078 ns 0.2764 ns 0.2586 ns 15.069 ns 14.591 ns 15.525 ns 0.0022 24 B
Field_Set_struct 34.790 ns 0.2475 ns 0.2194 ns 34.720 ns 34.551 ns 35.314 ns 0.0023 24 B

@steveharter steveharter self-assigned this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant