Re: Concurrent loading of images ?
Re: Concurrent loading of images ?
- Subject: Re: Concurrent loading of images ?
- From: Georg Seifert via Cocoa-dev <email@hidden>
- Date: Sat, 9 May 2020 15:28:23 +0200
Have you profiled this? The first thing I would to is run that in Instruments.
Georg
> Am 9. May 2020 um 14:44 schrieb Gabriel Zachmann via Cocoa-dev
> <email@hidden>:
>
> Again, thanks a lot for all the helpful hints.
>
> Before restructuring my code, I did a few timings, using a set of test images
> ranging in size from 30 through 300 MB.
> I used mach_absolute_time() for this experiment.
> And now, I am confused.
>
> These are the execution times I have found for some of the methods that I
> invoke in the process of loading and displaying the next image:
>
> CGImageSourceCreateWithURL: 0.4-1.4 millisec
> CGImageSourceGetStatus: 10-600 microsec
> CGImageSourceCopyPropertiesAtIndex: 0.8-9 millisec
> CGImageSourceCreateImageAtIndex: 15 microsec
> convertToNSImage (*): 25 microsec
> imgLayer.contents = nsimage: 1-5 microsec
> removeFromSuperlayer: 0.1 microsec
> addSublayer: 5-10 microsec
>
> (*): this is a wrapper method of mine that does a few calls to
> CIImage/NSImage/NSCIImageRep methods.
>
> Overall, none of the methods I invoke seems to incur a long execution time.
> Yet, there is a noticeable lag when my app switches from one image to the
> next one.
> I can tell because all layers have an animation assigned.
> Sometimes , there is even a stutter in the animation itself.
>
> But it doesn't seem like it makes sense at this point to load images in a
> concurrent/background dispatch queue, does it?
>
> So, I am confused: where is the lag coming from?
>
> Any ideas how I might be able to prevent the lag/stutter when loading and
> switching to big images?
>
>
> Best, G.
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden