• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Concurrent loading of images ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concurrent loading of images ?


  • Subject: Re: Concurrent loading of images ?
  • From: James Crate via Cocoa-dev <email@hidden>
  • Date: Fri, 8 May 2020 22:10:06 -0400

On May 8, 2020, at 6:00 PM, Gabriel Zachmann via Cocoa-dev
<email@hidden> wrote:
>
>> Sure. Just be aware that if you're using NSImage, simply loading an NSImage
>> does not rasterize it; the class tries to be 'lazy' about doing work. So
>> your background task should explicitly render it, e.g. into an
>> NSBitmapImageRep.
>
> I am using CGImageSourceCreateImageAtIndex and related functions.
> But I am still unclear which function actually takes the time.
> Maybe it is only when I create the CALayer like this?
>
> CALayer * imgLayer    = [CALayer layer];
> imgLayer.contents     = nsimage;

Reading a 50MB image will definitely take some time, so preloading the image
will definitely help. I’ve usually used an NSOperationQueue but my apps working
with images can sometimes be loading hundreds of images and NSOperationQueue
has an option to limit the number of operations run concurrently.  Since you’ll
only be loading the next image then a single GCD dispatch would work just as
well.

Also, if you’re already getting a CGImageRef using
CGImageSourceCreateImageAtIndex, why not just set imgLayer.contents to the
CGImageRef?

Jim Crate

_______________________________________________

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

  • Follow-Ups:
    • Re: Concurrent loading of images ?
      • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
    • Re: Concurrent loading of images ?
      • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
References: 
 >Concurrent loading of images ? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Concurrent loading of images ? (From: Jens Alfke via Cocoa-dev <email@hidden>)
 >Re: Concurrent loading of images ? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Concurrent loading of images ?
  • Next by Date: Re: Concurrent loading of images ?
  • Previous by thread: Re: Concurrent loading of images ?
  • Next by thread: Re: Concurrent loading of images ?
  • Index(es):
    • Date
    • Thread