Image.SaveAsPng is slow on Blazor. Is there an alternative? #1544
-
Hi,
The problem is the SaveAsPng is taking several seconds (5-10). Is there a faster alternative? Thanks for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
It shouldn't take that long normally. We need to know more about your environment (os, runtime, hardware etc.) |
Beta Was this translation helpful? Give feedback.
-
Placing an answer for people hitting this or a similar problem in the future: We do not recommend using ImageSharp in the browser when performance is important. Update: After having some chat on twitter and doing my own reading, I realized it's not even about SIMD. Client-side Blazor still uses an interpreter, which makes it practically impossible to do any compute-intensive task in the browser. .NET 6 should bring AOT (dotnet/aspnetcore#5466) which will may make things better, depending on how generics will be implemented in mono-wasm + AOT. WASM does not support SIMD yet, which makes it impossible to make the library fast on Blazor. |
Beta Was this translation helpful? Give feedback.
Placing an answer for people hitting this or a similar problem in the future:
We do not recommend using ImageSharp in the browser when performance is important.
Update: After having some chat on twitter and doing my own reading, I realized it's not even about SIMD. Client-side Blazor still uses an interpreter, which makes it practically impossible to do any compute-intensive task in the browser. .NET 6 should bring AOT (dotnet/aspnetcore#5466) which will may make things better, depending on how generics will be implemented in mono-wasm + AOT.
WASM does not support SIMD yet, which makes it impossible to make the library fast on Blazor.
Note that there is a proposal to add SIMD intrinsics …