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.