• 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: Optimizing PDFKit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimizing PDFKit


  • Subject: Re: Optimizing PDFKit
  • From: Ricky Sharp <email@hidden>
  • Date: Wed, 5 Oct 2005 16:41:53 -0500


On Oct 5, 2005, at 4:32 AM, Marcel Weiher wrote:


On 4 Oct 2005, at 22:11, Ricky Sharp wrote:


Anyhow, I wanted to make sure my image loading times would not suffer. I kept all my PDFs unencrypted and changed this line:

NSImage* theImage = [[NSImage alloc] initWithContentsOfFile:theImagePath];

to...

NSURL* thePDFURL = [[[NSURL alloc] initFileURLWithPath:theImagePath] autorelease];
PDFDocument* thePDFDocument = [[[PDFDocument alloc] initWithURL:thePDFURL] autorelease];


    if ([thePDFDocument isEncrypted])
        {
        // not yet implemented
        }

NSImage* theImage = [[NSImage alloc] initWithData: [thePDFDocument dataRepresentation]];


For the same run of a test script, the PDFKit code is a full order of magnitude slower. I'm running 10.4.2 on a dual 2GHz G5 and am concerned about users with slower machines.



Hmm...have you tested the first code with actually using the image? My guess is that that NSImage is being lazy and only actually reading/decrypting/rendering the PDF on-demand.

The timings I did actually spanned some other code; basically I timed how fast it took to navigate from screen to screen.


I believe you're correct though in that the original path takes its hit only when rendering the image. The PDFKit route adds to the problem since now there's a hit when loading.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Optimizing PDFKit (From: Ricky Sharp <email@hidden>)
 >Re: Optimizing PDFKit (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Re: Optimizing PDFKit
  • Next by Date: cocoa in carbon keyboard focus?
  • Previous by thread: Re: Optimizing PDFKit
  • Next by thread: Re: Optimizing PDFKit
  • Index(es):
    • Date
    • Thread