Strategies for tracking a tricky (typing) slowdown/lag bug
Strategies for tracking a tricky (typing) slowdown/lag bug
- Subject: Strategies for tracking a tricky (typing) slowdown/lag bug
- From: Keith Blount <email@hidden>
- Date: Mon, 21 Sep 2009 15:40:35 -0700 (PDT)
Hi,
This is most probably going to come across as a dumb question to the more hardened developers here, but I am a little stumped right now and pulling my hair out so please forgive any obtuseness on my part.
My app uses a heavily modified version of the OS X text system and has some typing lag issues. Generally it has always been fine, but in some circumstances typing would slow down (sometimes this is in part attributable to the fault of the OS X text system itself, which can slow to a crawl when trying to deal with even a few thousand words of justified text, but mostly it seems to be the result of a combination of factors in the highly customised and subclassed version of the text system my app uses). This problem has been exacerbated by Snow Leopard, so I have spent the last week running tests and optimising - Shark, Leaks, ObjectAlloc and so forth have all helped me find problem areas in my code that I have been able to optimise little by little.
However, even after all these texts, I have one particular situation where typing slows down to a crawl and none of the tools I am using seem to help me find the problem, even after re-reading the docs and online tutorials on Shark and Instruments and memory bug tracking in Cocoa; I’m at the stage where I feel like dowsing for bad code might be my only option. This is the situation:
• My app has a full screen typing mode. When you first start using it, typing is fine.
• After typing about 2,000 words in this mode, typing gets slower and slower. By 3,000 words it’s unbearable.
• If you quit the app and re-launch it, and continue typing at the end of that 2-3,000 word document, typing is fast again - but when you’ve added another 2 or 3,000 words, it slows right back down again.
Given that it gets slower over time and with typing, but clears out as soon as it’s quit and re-launched, I figured this must be a memory problem, but Leaks doesn’t seem to give me any useful information - there are no significant spikes and most areas of code in Leaks, ObjectAlloc and Shark bring up are system-related (sendEvent:, interpretKeys:, _redisplayRecursiveRect... etc - Leaks mainly reports NSTextInputContext’s -handleEvent:); barely any of my own code is attributed, even though it is clearly the culprit. Moreover the traces during slowdown don’t seem any different than during speedy typing (though that is perhaps unsurprising).
So, my no doubt ridiculously basic question is: how do I go about tracking a tricky bug or memory problem like this, where the main tools don’t seem to be giving any useful results? As I say, I have revised my memory of the docs on these tools, but no doubt I’ve missed something obvious somewhere, in which case I would be grateful if someone could slap me on the forehead and tell me to RTFM with a link to TFM. :)
Any pointers much appreciated.
Many thanks and all the best,
Keith
_______________________________________________
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