Make our appendCharacter: method faster by not creating and throwing away a string every time—instead, use CF to append the character directly. This, in turn, makes our Base64 code much faster.
authorPeter Hosey <hg@boredzo.org>
Mon Feb 08 08:10:56 2010 -0800 (2010-02-08)
changeset 4589d8b57dfcd2ae
parent 4588 7fd8e11501c6
child 4590 c5151d9559e7
Make our appendCharacter: method faster by not creating and throwing away a string every time—instead, use CF to append the character directly. This, in turn, makes our Base64 code much faster.
Common/Source/NSMutableStringAdditions.m
     1.1 --- a/Common/Source/NSMutableStringAdditions.m	Mon Feb 08 08:09:27 2010 -0800
     1.2 +++ b/Common/Source/NSMutableStringAdditions.m	Mon Feb 08 08:10:56 2010 -0800
     1.3 @@ -14,9 +14,7 @@
     1.4  @implementation NSMutableString (GrowlAdditions)
     1.5  
     1.6  - (void) appendCharacter:(unichar)ch {
     1.7 -	NSString *tmp = [[NSString alloc] initWithCharactersNoCopy:&ch length:1U freeWhenDone:NO];
     1.8 -	[self appendString:tmp];
     1.9 -	[tmp release];
    1.10 +	CFStringAppendCharacters((CFMutableStringRef)self, &ch, /*numChars*/ 1L);
    1.11  }
    1.12  
    1.13  @end