You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am trying to do an app for inside use for enterprise in Blazor - https://fir-ec434.web.app/. While it runs great on desktop, it feels laggy on mobiles. My simple measures show that C# runs ~50 times slower than JS, so I had to move performance critical parts(like url state persisting, which can grow up to O(5000) for every state change which uses UrlReactiveValueProvider or its' ChildValueExtractingReactiveValueProvider-s) to JS
Describe the solution you'd like
My app doesn't care about initial loading time, it would tolerate loading of whole 200mb JIT-runtime on first load as long as performance is native and long loading happens once and then app uses cache
Hence, my app would benefit from loading performant JIT instead of using interpreter
Additional context
By the way, described feature would be better than native apps for many use cases, like games
My typical user experience with AppStore and PlayStore games
Click install
Wait for load/install, while waiting browse the web or do other stuff
Close/Swipe from memory AppStore/PlayStore
Find app in menu
Click app to open it
For Blazor my expected user experience is:
Open url
Wait for load, while waiting browse the web or do other stuff
Open url with loaded app again
If you are interested in my simple measure, which shows ~50 times performance difference
// C# benchmark// var a = 0;// var s = DateTime.Now;// for (var i = 0; i < 1e7; i++)// {// ++a;// }// var f = DateTime.Now;// Console.WriteLine((f - s).TotalMilliseconds);// Console.WriteLine(a);//// JS benchmark// var a = 0; var s = Date.now(); for (var i = 0; i < 1e7; i++) { ++a }; var f = Date.now(); console.log(f - s); console.log(a);
The WebAssembly runtime is by design much more limited than a normal execution environment and anything approaching just in time compilation for a CLR would be extremely difficult.
Will we get NativeAOT or NativeAOT-llvm in blazor?
There are no immediate plans to switch Blazor WebAssembly to NativeAOT. Blazor WebAssembly currently uses the Mono AOT toolchain, the same toolchain used for .NET apps on iOS. Currently the NativeAOT support for WebAssembly is experimental.
Will we get NativeAOT or NativeAOT-llvm in blazor?
There are no immediate plans to switch Blazor WebAssembly to NativeAOT. Blazor WebAssembly currently uses the Mono AOT toolchain, the same toolchain used for .NET apps on iOS. Currently the NativeAOT support for WebAssembly is experimental.
Thanks for the info. Are there issue and roadmap about this experimental? Do we have guideline to enable it?
But actually I am more concern about full JIT support in browser wasm. I can't see why we need AoT in browser when browser actually could support loading and generating code at runtime anyway?
I am more concern about full JIT support in browser wasm. I can't see why we need AoT in browser when browser actually could support loading and generating code at runtime anyway?
From what I understand there is still a limitation in browsers that prevents the runtime generation and loading of WebAssembly modules in a manner suitable for JIT compilation.
Activity
javiercn commentedon Dec 2, 2020
@ivanivanyuk1993 thanks for contacting us.
We are moving this issue to the runtime repository since we don't own the underlying .NET runtime.
/cc: @danroth27
Dotnet-GitSync-Bot commentedon Dec 2, 2020
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
srxqds commentedon Dec 2, 2020
the browser can support jit mode?
ivanivanyuk1993 commentedon Dec 2, 2020
@srxqds
Well, since clr is written in C++, I think it's not a problem to download it and run it in wasm
lewing commentedon Jun 17, 2021
The WebAssembly runtime is by design much more limited than a normal execution environment and anything approaching just in time compilation for a CLR would be extremely difficult.
redradist commentedon Jan 17, 2022
Is there any work in this area ?
danroth27 commentedon Jan 18, 2022
Not currently due to web platform limitations. Our focus instead is on ahead-of-time (AOT) compilation.
SupinePandora43 commentedon Mar 27, 2022
Will we get NativeAOT or NativeAOT-llvm in blazor?
danroth27 commentedon Mar 31, 2022
There are no immediate plans to switch Blazor WebAssembly to NativeAOT. Blazor WebAssembly currently uses the Mono AOT toolchain, the same toolchain used for .NET apps on iOS. Currently the NativeAOT support for WebAssembly is experimental.
Thaina commentedon Apr 14, 2022
Thanks for the info. Are there issue and roadmap about this experimental? Do we have guideline to enable it?
But actually I am more concern about full JIT support in browser wasm. I can't see why we need AoT in browser when browser actually could support loading and generating code at runtime anyway?
danroth27 commentedon Apr 19, 2022
No, experimental means there isn't a committed roadmap for this functionality. See https://github.com/dotnet/runtimelab/blob/feature/NativeAOT-LLVM/docs/using-nativeaot/compiling.md#webassembly or additional details.
From what I understand there is still a limitation in browsers that prevents the runtime generation and loading of WebAssembly modules in a manner suitable for JIT compilation.