Skip to content

[browser] Move reflection from JS to C# - #98391

Merged
pavelsavara merged 13 commits into
dotnet:mainfrom
pavelsavara:browser_reflection
Feb 15, 2024
Merged

[browser] Move reflection from JS to C##98391
pavelsavara merged 13 commits into
dotnet:mainfrom
pavelsavara:browser_reflection

Conversation

@pavelsavara

@pavelsavarapavelsavara commented Feb 13, 2024

Copy link
Copy Markdown
Member

This decreases hazard of dealing with managed types in JS.
It also reduces the need to MONO_ENTER_GC_UNSAFE
It will allow to initiate bind_assembly_exports from UI to deputy thread.
Allocate gc-roots for monoStringToStringUnsafe earlier.

Contributes to #98366

@pavelsavarapavelsavara added arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm labels Feb 13, 2024
@pavelsavarapavelsavara added this to the 9.0.0 milestone Feb 13, 2024
@pavelsavarapavelsavara self-assigned this Feb 13, 2024
@ghost

Copy link
Copy Markdown

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

Issue Details

This decreases hazard of dealing with managed types in JS.
It also reduces the need to MONO_ENTER_GC_UNSAFE

Contributes to #98366

Author:pavelsavara
Assignees:pavelsavara
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript, os-browser

Milestone:9.0.0

@pavelsavara
pavelsavara marked this pull request as ready for review February 13, 2024 22:05
@pavelsavara

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-wasm

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment threadsrc/mono/browser/runtime/debug.ts
Comment threadsrc/mono/browser/runtime/invoke-cs.ts Outdated
Comment threadsrc/mono/browser/runtime/managed-exports.ts
Comment threadsrc/mono/browser/runtime/run.ts

@marafmaraf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me 👍

@pavelsavara

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-wasm

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-wasm

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara

Copy link
Copy Markdown
MemberAuthor

I filled #98486

@radekdoulik

Copy link
Copy Markdown
Member

Looks like this change increased the cold browser template startup time, probably increased the size. The range is 741c0c8...c34474e

image

Is there anything we can do to improve it?

@lewing

lewing commented Feb 15, 2024

Copy link
Copy Markdown
Member

I think we should discuss this more, it pulls in a lot more managed code and the long term fix is different.

@pavelsavara

Copy link
Copy Markdown
MemberAuthor

We can move it back to C/mono, but call it from C# side.
I think that Blazor is full of similar reflection anyway ?

@pavelsavara

Copy link
Copy Markdown
MemberAuthor

Is there anything we can do to improve it?

I moved it back to C, but called from the managed thread. #98534

Could you please check the perf with this ? @radekdoulik many thanks!

@github-actionsgithub-actionsBot locked and limited conversation to collaborators Mar 18, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasmWebAssembly architecturearea-System.Runtime.InteropServices.JavaScriptos-browserBrowser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@pavelsavara@radekdoulik@lewing@maraf