discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's the faster way to change attributes of string ?


From: Yen-Ju Chen
Subject: Re: What's the faster way to change attributes of string ?
Date: Wed, 06 Aug 2003 14:31:38 -0400




From: 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.

 I change the color and font for each keyword in the source code.
 I'll try to implement the second one to see the difference.
 Thanx.

 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]