• 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: Strategies for tracking a tricky (typing) slowdown/lag bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strategies for tracking a tricky (typing) slowdown/lag bug


  • Subject: Re: Strategies for tracking a tricky (typing) slowdown/lag bug
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 23 Sep 2009 08:46:20 -0700


On Sep 23, 2009, at 6:55 AM, Keith Blount wrote:

So now that I know it's CPU, the question is, how do I track it, given that I've been having poor luck with Activity Monitor and Shark in finding the problem areas of code? What I don't understand is how more and more CPU can get eaten up like this, when the program is doing the same thing. If typing starts eaten up only 22-34% of the CPU, why doesn't it stay like this? Obviously it has nothing to do with the length of the document, as if the program is restarted, CPU usage is back down again when typing in the same document (until you add another 1,000 words of course).

What it looks like from the sample is that there's some pathological explosion of large numbers of temporary attributes.
Nearly all the time is spent inside your -[KMBTextView applyTemporaryAttributesToRange:], which in turn spends all of its time in -[NSLayoutManager removeTemporaryAttribute:forCharacterRange:].


One thing sampling won't tell you is whether a hot method is being called many times, or whether it takes a lot of time to run. You can answer that by instrumenting your code, either keeping a counter or just logging on every call. My guess is that these particular methods aren't called that many times but are taking a long time. And what that NSLayoutManager method is doing is twiddling arrays of dictionaries, presumably the style runs and attributes.

Another useful tool at this point would be 'heap', which tells you how many blocks are in your process's malloc heap, and how many of those are which class of object. You might find very large numbers of small objects, if you compare a heap dump before and after the app gets into this state.

—Jens

PS: Do you work on Scrivener? I love that app :)_______________________________________________

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: Strategies for tracking a tricky (typing) slowdown/lag bug
      • From: Keith Blount <email@hidden>
References: 
 >Re: Strategies for tracking a tricky (typing) slowdown/lag bug (From: Keith Blount <email@hidden>)

  • Prev by Date: Re: Multiline label allignment issue.
  • Next by Date: Re: Stability on Snow Leopard
  • Previous by thread: Re: Strategies for tracking a tricky (typing) slowdown/lag bug
  • Next by thread: Re: Strategies for tracking a tricky (typing) slowdown/lag bug
  • Index(es):
    • Date
    • Thread