BTC
USD
79,337
EUR
67,787
GBP
58,712
BTC
USD
79,337
EUR
67,787
GBP
58,712
BTC
USD
79,337
EUR
67,787
GBP
58,712
BTC
USD
79,337
EUR
67,787
GBP
58,712
BTC
USD
79,337
EUR
67,787
GBP
58,712
BTC
USD
79,337
EUR
67,787
GBP
58,712
BTC
USD
79,337
EUR
67,787
GBP
58,712

Cómo usar las funciones de uso compartido cercano de Windows 11109764

Cómo usar las funciones de uso compartido cercano de Windows 11109764


Production WebAssembly with Blazor: AOT, WASM Performance Optimization, and Offline-First PWA Architecture

Now, when publishing the application using the Release configuration, we should get a single executable containing WebAssembly code. It makes the application execute faster in the browser but often comes with the downside of larger sizes, resulting in longer download duration. With trimming and other optimizations, AOT-compiled applications can be smaller than JIT-compiled applications. With JIT, we write our applications using one of the available .NET programming languages, mostly C#, F# or Visual Basic .NET. Explore these features, and don’t hesitate to experiment with your Blazor applications to see what works best for your specific use case! To implement lazy loading in your Blazor application, you can utilize the Lazy component.

Advanced Client Capabilities

Another often overlooked disadvantage of AOT is that System.Linq.Expressions always use the interpreted form instead of runtime-generated compiled code. When shipping the .NET applications self-contained, the opposite is often true. If the application does not run as expected, it could be that trimming the .NET IL code after the AOT compilation is the problem. Notice that compilation and publishing will take considerably longer than regular JIT-compiled Blazor WebAssembly applications.

From my experience, primarily cloud-native and highly scalable applications (such as .NET APIs) running in the cloud benefit from AOT. AOT promises faster startup times, lower memory footprint and larger application sizes. The RunAOTCompilation setting enables native AOT compilation for Blazor WebAssembly applications. The application also consumes less memory because of the lack of runtime compilation.

As indicated in the Project Properties help text, the AOT compilation will run when the project is published. I recommend that you remove the first property sweepstakes group so that the AOT compilation will only run for Release builds. The ‘Ahead-of-time (AOT) compilation’ option is the one we need for the Blazor WebAssembly AOT compilation. Note that the ‘Publish native AOT’ option is a separate thing you could consider enabling for your .NET APIs.

Render cycles are lightweight by design, but in large applications, repeated rendering of deep component trees or grid-heavy pages adds cost. The blazor.boot.json file lists all assemblies, their sizes, and the files the runtime loads during startup. Because the .NET code is interpreted, apps typically run slower than they would on a server-side .NET just-in-time (JIT) runtime. Because the .NET IL code is interpreted, apps typically run slower than they would on a server-side .NET JIT runtime without any IL interpretation.

  • WasmGC introduces managed object support directly in WebAssembly, removing the need for .NET’s runtime emulation on top of WASM’s linear memory model.
  • LocalStorage works for simple flags or small settings, but it’s synchronous, size-limited, and unsuitable for structured or transactional data.
  • All right—we’ve already built our component.
  • If _userState changes (even by reference), the entire subtree re-renders.

First of all, enabling AOT compilation will increase the overall size of your application, since the compiled WebAssembly code isn’t as compact as the .NET IL (Intermediate Language) instructions. Enabling AOT compilation converts .NET Intermediate Language (IL) into native WebAssembly at build time, which can provide significant performance gains. Production Blazor WebAssembly applications need continuous performance validation to prevent regressions.

If you prefer working in C# instead of writing JavaScript worker code manually, SpawnDev.BlazorJS.WebWorkers wraps Web Workers in a typed API. This keeps UI interactions smooth while computationally expensive work happens in parallel. Running these on the UI thread leads to frozen input, delayed rendering, and jittery scrolling. This data flows through your existing state and routing patterns, reinforcing the predictable workflow introduced earlier in the article. User InterventionThe UI shows a “conflict” dialog allowing the user to choose between local and server versions.

Additional resources

Offline-first Blazor WebAssembly applications need a browser database that can store large datasets and operate safely when the network is unavailable. Blazor WebAssembly must download the runtime, assemblies, and static assets before the application can execute. Both libraries improve performance in large applications by isolating state and eliminating unnecessary updates. Together, these runtime improvements allow many Blazor WASM apps to run efficiently without fully compiling every assembly ahead of time. AOT compilation addresses this performance issue by compiling an app’s .NET code directly into WebAssembly for native WebAssembly execution by the browser.

1.2 Using SpawnDev.BlazorJS.WebWorkers or Experimental .NET Threading Support

You have to try it with your application to see how the result is in a particular use case. That’s also why AOT compilation is only performed when publishing the application and only in the Release configuration. Now, say we want to use AOT compilation for a Blazor WebAssembly application. It is usually only relevant in high-scale situations where you must deploy multiple application instances. This benefits cloud deployments because less bandwidth is consumed when deploying the application. With ahead-of-time (AOT) compilation, we compile the C#, F# or Visual Basic .NET code to machine code instead of Intermediate Language (IL) code.

It’s a technique used to reduce the size of the _framework folder. A simple project takes at least two to three minutes on a modern computer. You can also use Visual Studio and right-click publish the WebAssembly project. Before we learn about AOT compilation, let’s look at the strengths of JIT compilation and why it has been the only option for a long time. Since the introduction of .NET Framework in 2002 to the early days of .NET (Core) in 2016, just-in-time (JIT) compilation is how the .NET platform worked. Instead of using the built-in @bind directive for complex forms, consider using a more explicit state management approach.

Post a comment