Replies: 5 comments 11 replies
-
@Webreaper this is a feature that currently does not exist, however I personally really would like to investigate and hopefully realize it for the next major release. However, I think the main performance benefit that comes with this is reduced memory footprint rather than better speed / lower CPU usage.
That sounds a lot, should be much less for for both libraries normally. Can you elaborate a bit more on your use case? (What platform/runtime/hardware? What exactly is included in those 3 operations? How do you benchmark? Any sample (pseudo) code for the benchmark?) |
Beta Was this translation helpful? Give feedback.
-
Sure. I originally asked this question and it was the answer which lead me to think that loading that's the bottleneck. My app is running in .Net Core 5-RC1, but I see the exact same perf characteristics in 3.1. It's running on a Mac (during development) and on a Linux box when deployed. My pipeline does the following in ImageSharp:
The 3 resizes are done in serial - so the first resize might be from 4000x3600 => 800 x 600, the next one would be 800x600 => 400x250, and the next 400x250 => 120x120. I use the previously resized image as the source for the next-smallest thumb to save time. The images being converted are large (~7MB) images from an SLR camera. The app processes images in batches of 100, and typically takes around 120-130s for each 100 images.
I haven't profiled in detail; I can add some GetTickCount timings around the ImageSharp load and transform code, and do the same for SkiaSharp to figure out if one particular area would be the bottleneck. If you think it's possible to get this faster, then I'd much prefer to use ImageSharp - because the above code is so much simpler and more intuitive than the equivalent SkiaSharp code (which runs to about 300+ lines...). |
Beta Was this translation helpful? Give feedback.
-
Okay, so, running this with .Net 3.1 and your test image, it takes 918ms. Bear in mind that for reasons too painful to go into, I have turbo-boost disabled on my MacBook's (which is a 1.1Ghz quad-core i5). If I enable turbo boost, it drops to 442ms. I ran this for one of my larger images. Mean time was 693ms (turbo enabled), and 1331ms with turbo disabled - which lines up approximately with the performance I've been seeing previously. So I guess part of this is just that I have a slow laptop/dev machine. ;) These speeds are also consistent relative to the performance you see with your i7... |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback. The app I'm writing is basically a sort of Blazor Server Lightroom, for extremely large collections of photos. Caching doesn't help; I'm actually already doing that - I have a background process that batch-creates all of the thumbnails and writes them to disk, so that all photos have all thumbnails available permanently. In my photo library (around 500k images/3TB of photos) it takes around 3-4 days to do them all with SkiaSharp (6-7 with ImageSharp) but then it's done, and they're only regenerated if an image changes. I have thought about making the thumbnail generation real-time (rather than batch-converting up-front) but if somebody's scrolling through a list of 500 images, then generating the thumbs is going to take 2-3 minutes, which isn't really acceptable. But it's something I might consider (somebody who has a beefy CPU might prefer to take that option over using a couple of hundred MB of space on disk for the thumbs....). It's on my list.... |
Beta Was this translation helpful? Give feedback.
-
Just flagging up the fact that this PR is going to solve the issue raised in this discussion: #2076 - wooooohooo! 👍 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was using ImageSharp for bulk thumbnail generation, but ended up switching to SkiaSharp, because the performance of ImageSharp was just not quite quick enough. Loading a bunch of 7MB JPEGs, and then resizing down to 3 small thumbnails, takes around 1.2s per image with ImageSharp, and around 0.6s per image with SkiaSharp.
I know the bulk of the time is in the loading, and that you guys are working on intrinsics, which should speed things up significantly. But I wondered whether you also have the concept of reduced loading by codec on the roadmap? So with SkiaSharp, I can do this:
where
nearest
is a scaled rect that I'm trying to load the optimal image for. The codec then loads just the size of image that's closest tonearest
, which is significantly faster. This means that if I have a 4000x3600 image, and I want to resize to 800x600, Skia will load a 1000x800 image, which I can then resize. This clearly saves a lot of effort, and probably accounts for a lion-share of the processing time.Any thoughts to add this to ImageSharp? Since so many people use it for Thumbnail generation/image reduction, it feels like this would be pretty welcome.
If ImageSharp can do this already, please let me know - I couldn't figure out how from the docs. :)
Beta Was this translation helpful? Give feedback.
All reactions