Uh oh!
There was an error while loading. Please reload this page.
[wasm] Improvements to startup performance of mono_wasm_get_assembly_exports - #99924
Conversation
kg
commented
Mar 18, 2024
Requesting review to get feedback. I hope someone knows trimming better than me and can suggest how to fix this. Put a dependency attribute of some kind on the generated module initializer, maybe? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
64759a1 to
8a4b7fcCompare8a4b7fc to
96666c5Comparepavelsavara
commented
Apr 3, 2024
Could you please show the generated code ? |
kg
commented
Apr 3, 2024
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute]unsafeclass__GeneratedInitializer{[global::System.ThreadStaticAttribute]staticboolinitialized;[global::System.Runtime.CompilerServices.ModuleInitializerAttribute,global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods|global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods,typeof(__GeneratedInitializer))]staticinternalvoid__Net7SelfInit_(){}[global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute("__Wrapper_PrepareToRender_1401412665","MainJS","RayTracer")][global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute("__Wrapper_OnClick_1317452459","MainJS","RayTracer")]staticvoid__Register_(){if(initialized||global::System.Runtime.InteropServices.RuntimeInformation.OSArchitecture!=global::System.Runtime.InteropServices.Architecture.Wasm)return;initialized=true;global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[RayTracer]MainJS:PrepareToRender",1401412665,newglobal::System.Runtime.InteropServices.JavaScript.JSMarshalerType[]{global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.ArraySegment(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte),global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32,global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32});global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[RayTracer]MainJS:OnClick",1317452459,newglobal::System.Runtime.InteropServices.JavaScript.JSMarshalerType[]{global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task()});}} |
pavelsavara
commented
Apr 4, 2024
Let's rename |
9b8c760 to
77f918bComparepavelsavara
commented
Apr 4, 2024
Here we are removing support for 3rd party library/nuget generated by Net9 SDK from being able to run on Net7 runtime. |
maraf
commented
Apr 5, 2024
.NET 7 is EOL on May 14, 2024. Removing support seems reasonable to me |
radekdoulik
commented
Apr 10, 2024
…exports (dotnet#99924) Change generated JSImport/JSExport initializer to not rely on Environment.Version, for faster startup

Generated JSImport/JSExport initializer does an
Environment.Versioncheck to see if we're on NET7. That check is tremendously expensive, because it fetches a CustomAttribute instance off of something in corlib, then parses the version string (parsing version strings initializes a bunch of stuff). This PR removes that check and adds a linker dependency to keep the registration method alive so it can be called when needed.We will also need to document that DLLs (in nugets?) generated by this new version of the generator won't work on NET7 runtimes, since the relevant logic to perform automatic registration on that version.