|
From: | Yen-Ju Chen |
Subject: | Re: What's the faster way to change attributes of string ? |
Date: | Wed, 06 Aug 2003 18:05:23 -0400 |
From: "Yen-Ju Chen" <yjchenx@hotmail.com> To: discuss-gnustep@gnu.org Subject: Re: What's the faster way to change attributes of string ? Date: Wed, 06 Aug 2003 14:31:38 -0400From: Alexander Malmberg <alexander@malmberg.org> To: discuss-gnustep@gnu.org Subject: Re: What's the faster way to change attributes of string ? Date: Wed, 06 Aug 2003 19:58:13 +0200 Yen-Ju Chen wrote: > I have two choices: > 1. Build a new NSAttributedString and use [NSTextStorage > setAttributedString:]. > 2. Directly use -addAttribute:value:range: on NSTextStorage. > Is there any significant difference in speed between this two ways ? Unless you're changing the attributes of every single character in the string, #2 should be faster, but perhaps not by much. However, for #2, it's very important that you call -beginEditing before the first change and -endEditing after the last change. Otherwise, #2 will be very slow.
Well, they are equally slow when changing the color and font on every keyword of NSTextView.m.
From -beginEditing to -endEditing takes only 5-8 seconds,after that, it takes almost 1 min to render the NSAttributedString on NSTextView.
It is tested with CodeEditor CVS, with backart. (xlib-backend is roughly the same slow. I just didn't measure the time). Yen-Ju
- Alexander Malmberg _______________________________________________ Discuss-gnustep mailing list Discuss-gnustep@gnu.org http://mail.gnu.org/mailman/listinfo/discuss-gnustep_________________________________________________________________Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963_______________________________________________ Discuss-gnustep mailing list Discuss-gnustep@gnu.org http://mail.gnu.org/mailman/listinfo/discuss-gnustep
_________________________________________________________________Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail
[Prev in Thread] | Current Thread | [Next in Thread] |