ImageSharp icon indicating copy to clipboard operation
ImageSharp copied to clipboard

6-7 second save for webp on azure server

Open HappyCatKitten opened this issue 3 years ago • 2 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have verified that I am running the latest version of ImageSharp
  • [X] I have verified if the problem exist in both DEBUG and RELEASE mode
  • [X] I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

2.1.0

Other ImageSharp packages and versions

SixLabors.ImageSharp.Formats.Webp;

Environment (Operating system, version and so on)

Windows Azure Service App

.NET Framework version

6.0 .net core

Description

When I run SaveAsWebp() on my dev machine.. 300ms

When I run on an Azure App service (1cpu/1.75GB mem) it takes 6-7 seconds. Jpg encoder is fast on App service

image.SaveAsWebp(memoryStream, new WebpEncoder() { Quality = quality, Method = WebpEncodingMethod.BestQuality, FileFormat = WebpFileFormatType.Lossy, });

Is there some additional IO that could be stalling the process? seems weird its only happening for webp.

Interested to hear your thoughts!

Steps to Reproduce

deploy simple app that calls SaveAsWebp() on azure app service.

Images

No response

HappyCatKitten avatar May 01 '22 21:05 HappyCatKitten

@HappyCatKitten do you know what CPU's are used in Azure App service? Do they support hardware intrinsics like SSE2 or AVX2? If not, that could be the cause of the difference.

The other thing is, BestQuality is actually expected to be slow. You should only use this method, if encoding times does not really matter. The encoding is actually done multiple times with different strategies and then the best (= the one with the least amount of bytes is picked). Maybe trying the Default encoding method would be worth a try.

brianpopow avatar May 02 '22 11:05 brianpopow

Hey @HappyCatKitten can you please answer the above question?

JimBobSquarePants avatar May 18 '22 11:05 JimBobSquarePants

I'm gonna close this. It's been months without reply

JimBobSquarePants avatar Sep 09 '22 23:09 JimBobSquarePants