Re: TextView question
Re: TextView question
- Subject: Re: TextView question
- From: Jason Jasmin <email@hidden>
- Date: Thu, 10 Aug 2006 23:48:25 -0400
On Aug 10, 2006, at 3:42 PM, Andreas Mayer wrote:
What is "relatively slow" and what exactly (show some code!) did
you try?
Sorry, I should have been more specific earlier... My problem is that
in my code, for each loop iteration, I call NSLog twice, and write
one line of output to my log window. If I disable all output to my
log window, and just leave the NSLog calls, the app runs very quickly
(on the order of 5 seconds or so). I can see the NSLog entries in
XCode flying by quickly. When I enable output to my logging window,
the app slows down dramatically, taking > 20 seconds to run.
Normally this wouldn't be a huge problem (I don't expect there to be
that much output in production), but it's annoying because the XCode
run log proves that the output can be a lot faster than it is.
I've looked around the net for various "high performance" text
solutions, and none of them are apparently any faster than what I had
originally. Here's what I've got right now, it's the simplest text
update code I could come up with:
NSRange range = NSMakeRange([[logView2 string] length], 0);
NSString *newText = [theText stringByAppendingString:@"\n"];
[logView2 replaceCharactersInRange:range withString:newText];
[logView2 scrollRangeToVisible:range];
Now if I comment the last line out (the scrollRangeToVisible) then it
runs fast enough for me (it seems a little slower than with the
entire logging function disabled, but it's in the same ballpark as
XCode -- close enough).
I've tried a few variations on that code, caching the length of the
text to avoid calling NSString:length and so forth, but nothing makes
any significant difference
Jason
_______________________________________________
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