Improve performance by handing out proxy to internal string

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12418 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-02-06 13:55:49 +00:00
parent e931b93591
commit d20683b862
3 changed files with 11 additions and 1 deletions

View file

@ -34,6 +34,7 @@
{
NSMutableString *_textChars;
NSMutableArray *_infoArray;
NSString *_textProxy;
}
@end

View file

@ -504,7 +504,11 @@ _attributesAtIndexEffectiveRange(
- (NSString*) string
{
return AUTORELEASE([_textChars copyWithZone: NSDefaultMallocZone()]);
if (_textProxy == nil)
{
_textProxy = RETAIN([_textChars immutableProxy]);
}
return _textProxy;
}
- (NSDictionary*) attributesAtIndex: (unsigned)index
@ -777,6 +781,7 @@ changeInLength: [aString length] - range.length];
- (void) dealloc
{
TEST_RELEASE(_textProxy);
RELEASE(_textChars);
RELEASE(_infoArray);
[super dealloc];