Made the Base64 code much faster (saving 20% of the time off of every WebKit display fade-in) by using -appendCharacter: instead of -appendFormat:. Also declared the character array as const.
authorPeter Hosey <hg@boredzo.org>
Sun Feb 07 07:22:08 2010 -0800 (2010-02-07)
changeset 4577073a82c1a4fb
parent 4576 82b0239f29b5
child 4578 fe44b97253d1
Made the Base64 code much faster (saving 20% of the time off of every WebKit display fade-in) by using -appendCharacter: instead of -appendFormat:. Also declared the character array as const.
Plugins/Displays/WebKit/GrowlWebKitWindowController.m
     1.1 --- a/Plugins/Displays/WebKit/GrowlWebKitWindowController.m	Thu Jan 21 22:42:48 2010 -0800
     1.2 +++ b/Plugins/Displays/WebKit/GrowlWebKitWindowController.m	Sun Feb 07 07:22:08 2010 -0800
     1.3 @@ -378,7 +378,7 @@
     1.4  
     1.5  @implementation NSData (Base64Additions)
     1.6  
     1.7 -static char encodingTable[64] = {
     1.8 +static const unichar encodingTable[64] = {
     1.9  	'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
    1.10  	'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
    1.11  	'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
    1.12 @@ -421,7 +421,7 @@
    1.13  		}
    1.14  		
    1.15  		for( i = 0; i < ctcopy; i++ )
    1.16 -			[result appendFormat:@"%c", encodingTable[outbuf[i]]];
    1.17 +			[result appendCharacter:encodingTable[outbuf[i]]];
    1.18  		
    1.19  		for( i = ctcopy; i < 4; i++ )
    1.20  			[result appendString:@"="];