You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that I am running the latest version of ImageSharp
I have verified if the problem exist in both DEBUG and RELEASE mode
I have searched open and closed issues to ensure it has not already been reported
ImageSharp version
2.1.2
Other ImageSharp packages and versions
???
Environment (Operating system, version and so on)
Windows 11 x64
.NET Framework version
6.0.5
Description
Hi ImageSharp,
Run this code with the attached image and you'll see that loading TIFFs is 50x slower than SDI.
Can you please take a look? Happy to buy a license / sponsorship if we can get this resolved sooner rather than later.
Steps to Reproduce
var Input = $@"C:\Users\TonyV\Downloads\Image1.tiff";
var SW1 = System.Diagnostics.Stopwatch.StartNew();
for (int i = 0; i < 100; i++) {
System.Drawing.Image.FromFile(Input);
}
Console.WriteLine($@"SW1 {SW1.Elapsed}");
var SW2 = System.Diagnostics.Stopwatch.StartNew();
for (int i = 0; i < 100; i++) {
SixLabors.ImageSharp.Image.Load(Input);
}
Console.WriteLine($@"SW2 {SW2.Elapsed}");
Won't be surprised if SDI uses the same 'optimization' technique as in jpeg decoder-encoder with caching the initial file if image wasn't changed. I'll actually test it right now.
With #2134 merged to main, the image linked here should decode much faster. The image uses Fax4 compression, but all fax de-compression should be faster now.
Activity
brianpopow commentedon May 28, 2022
@TonyValenti If you buy a license, I could take a look into this. I have some idea's why this might be slow.
edit: disclaimer: I am pretty sure we can make it faster, but I cannot promise a speedup of 50.
TonyValenti commentedon May 28, 2022
@brianpopow Done! I'd be surprised if you got a 50x speedup as well, but I'd be quite happy with 49x. :-)
br3aker commentedon May 28, 2022
Won't be surprised if SDI uses the same 'optimization' technique as in jpeg decoder-encoder with caching the initial file if image wasn't changed. I'll actually test it right now.
UPD:
Didn't read it's only a load operation...
brianpopow commentedon May 28, 2022
@TonyValenti Is it ok for you, if we use the image you have provided in our benchmarks?
TonyValenti commentedon May 28, 2022
Yep!
TonyValenti commentedon May 29, 2022
Also, I'm sure you've noticed, but it seems like memory usage explodes too.
JimBobSquarePants commentedon May 29, 2022
Let’s do some proper benchmarking. Those tests above will be wildly inaccurate. The code sample leaks memory also
brianpopow commentedon Jun 9, 2022
With #2134 merged to main, the image linked here should decode much faster. The image uses Fax4 compression, but all fax de-compression should be faster now.
You can try it out with our latest nightly