Share via

Performance delay in Blazor WASM application compared to Blazor Server application

Muppala Keerthi 1 Reputation point
2023-08-08T13:22:45.2633333+00:00

While trying to read an XML file in a loop of 100 times, we found time delay in Blazor WASM application compared to Blazor Server application. Please find the simple samples tried at our end to reproduce the issue.

 

Server Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Blazor_Server1857737694.zip

WASM Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Blazor_WebApp-2021490426.zip

 

Time Taken:

 

Server: approx. less than 850ms

WASM: approx. greater than 40000ms

 

Kindly investigate this and provide the details on this time delay in the WASM application.

Developer technologies | .NET | Blazor
0 comments No comments

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 84,086 Reputation points
    2023-08-08T15:49:52.72+00:00

    its pretty simple.

    with blazor server, the code opens a local file and parses.

    with Blazor WASM, the code, calls javascript to download the file data, encode to base 64, and pass to blazor WASM via jsinterop. The Blazor code then decodes the data back to a buffer. it then parses the buffer.

    so the WASM has the overhead, of http download, encode/decode of data, plus the sending the data over the js to WASM message system (js interop).

    you could probably improve performance, by having the server convert the xml to json, and use the GetFromJsonAsync() as its more optimized.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.