KEMBAR78
Use emit-based invoke for all of WASM including DI by steveharter · Pull Request #85065 · dotnet/runtime · GitHub
Skip to content

Conversation

@steveharter
Copy link
Contributor

@steveharter steveharter commented Apr 19, 2023

Makes the newer emit-based reflection added to Mono in .NET 8.0 also support Blazor\WASM.

Also addresses main requirement for #66153 which is to allow ASP.NET to use DI's ActivatorUtilities.CreateFactory without a ~259K size regression (measuring size of .br files).

The perf results for using an emit-based invoke instead of interpreted are not as good as the 2x-3x we saw for Core and Mono, but the expected overall improvement should be ~20-30% with the largest gain by far being a zero-arg constructor which is ~2.2x faster. Once the new fast invoke APIs are ready (which are based on emit), those are expected to further improve most cases; these will be used by DI once available.

Measurements below are in ms and for 1,000,000 iterations. Also includes the object[] parameters alloc for MethodBase.Invoke() for cases that have parameters.

Test Before After Ratio
constructor (0 args) 430 195 2.21
constructor (3 args) 2015 1660 1.21
constructor (5 args) 2585 2293 1.13
method (0 args) 1008 718 1.40
method (3 args) 2601 2322 1.12
method (5 args) 3218 2918 1.10
set property 1730 1420 1.22
get property 111 108 1.03

@steveharter steveharter self-assigned this Apr 19, 2023
@ghost
Copy link

ghost commented Apr 19, 2023

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Issue Details

Makes the newer emit-based reflection added to Mono in .NET 8.0 also support Blazor\WASM. (perf numbers to come in a bit).

Also addresses main requirement for #66153 which is to allow ASP.NET to use DI's ActivatorUtilities.CreateFactory without a ~259K size regression (measuring size of .br files).

Author: steveharter
Assignees: steveharter
Labels:

area-System.Reflection

Milestone: -

@steveharter steveharter added this to the 8.0.0 milestone Apr 19, 2023
@ghost
Copy link

ghost commented Apr 19, 2023

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Issue Details

Makes the newer emit-based reflection added to Mono in .NET 8.0 also support Blazor\WASM. (perf numbers to come in a bit).

Also addresses main requirement for #66153 which is to allow ASP.NET to use DI's ActivatorUtilities.CreateFactory without a ~259K size regression (measuring size of .br files).

Author: steveharter
Assignees: steveharter
Labels:

area-System.Reflection, tenet-performance

Milestone: -

@lambdageek lambdageek requested a review from maraf April 19, 2023 19:53
@lambdageek lambdageek added the arch-wasm WebAssembly architecture label Apr 19, 2023
@ghost
Copy link

ghost commented Apr 19, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Makes the newer emit-based reflection added to Mono in .NET 8.0 also support Blazor\WASM. (perf numbers to come in a bit).

Also addresses main requirement for #66153 which is to allow ASP.NET to use DI's ActivatorUtilities.CreateFactory without a ~259K size regression (measuring size of .br files).

Author: steveharter
Assignees: steveharter
Labels:

arch-wasm, area-System.Reflection, tenet-performance

Milestone: 8.0.0

@ghost
Copy link

ghost commented Apr 19, 2023

Tagging subscribers to 'arch-android': @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

Issue Details

Makes the newer emit-based reflection added to Mono in .NET 8.0 also support Blazor\WASM. (perf numbers to come in a bit).

Also addresses main requirement for #66153 which is to allow ASP.NET to use DI's ActivatorUtilities.CreateFactory without a ~259K size regression (measuring size of .br files).

Author: steveharter
Assignees: steveharter
Labels:

arch-wasm, area-System.Reflection, tenet-performance, os-android

Milestone: 8.0.0

@lewing lewing requested review from pavelsavara and vargaz April 20, 2023 01:14
Copy link
Contributor

@buyaa-n buyaa-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, the comment here was helpful for understanding better

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-System.Reflection tenet-performance Performance related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants