.Net Blazor WebAssembly sounds really great. It can run fully client-side, meaning there is no need for a dynamic server and one can even host it on a CDN. Even better, it is possible to turn it into an installable PWA. So I looked at some demos and was horrified to find out, that loading an example page on synfusion.com approximately took me 15 seconds with a decent internet connection.
Here is the example: https://blazor.syncfusion.com/showcase/wasm/health-tracker/
I do absolutely understand, that the entire .Net Runtime for Webassembly needs to be downloaded and that this naturally takes some time, and I have already measured, that the time on subsequent loads, when the runtime for the page is already cached, is "only" about 3 to 5 seconds.
This however is still a lot, and in my opinion unusable in a real life secnario. Which user is going to wait for a website that takes 15 seconds to load?
所以我的问题是,肯定有一种内置的方法来缩短启动时间.也许人们只能加载.Net运行时的那些部分,这些部分是主页或用户请求的任何页面工作所必需的.我理解这一点,这可能很困难,因为.NET运行时很可能是非常相互关联的,并且大多数部分将依赖于其他部分.我可以想象,在下载WebAssembly运行时之前,首先会提供一个传统的HTML/Js/css页面.也许至少可以显示尚未交互的用户界面,给用户一种速度感?另外,为什么后续加载要花费3秒以上的时间?运行时应该被缓存,从缓存中检索它真的需要那么长时间吗?
如果有人知道如何在.Net Blazor WASM应用程序中改善启动时间,我会很高兴听到解决方案,因为默认的启动时间长得令人无法忍受,至少对我来说,这不适用于任何现实世界的场景,这真的是一种巨大的耻辱.
PS:
I of course have also tried to built my own page and measured the initial startup time and the cached one, which both are faster than the syncfusion ones, but of course the application is also way smaller in size, when compiled and built.
啊,是的,对于任何想要一个最小可重现示例的人来说,以Visual Studio中的Web应用程序模板为例,将其配置为Interactive Render模式=WebAssembly,并勾选"Include Sample Pages".