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

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
  • Follow-Ups:
    • Re: TextView question
      • From: Spencer Salazar <email@hidden>
    • Re: TextView question
      • From: Andreas Mayer <email@hidden>
    • Re: TextView question
      • From: Chris Suter <email@hidden>
References: 
 >TextView question (From: Jason Jasmin <email@hidden>)
 >Re: TextView question (From: Andreas Mayer <email@hidden>)

  • Prev by Date: redrawing an NSPopUpButtonCell, and ghost effect
  • Next by Date: Why doesn't Apple's installer let me choose architecture?
  • Previous by thread: Re: TextView question
  • Next by thread: Re: TextView question
  • Index(es):
    • Date
    • Thread