diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-08-20 10:02:00 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-08-20 10:02:00 +0000 |
commit | d17a6b638e529694685a333162bbf6fec6c7fc08 (patch) | |
tree | 5c72506af7bf75299c093ce6a47b7cc4a956e0ff /Source/SPQueryController.m | |
parent | dabf6466f11e5936ee871b8b3dd573020a142586 (diff) | |
download | sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.tar.gz sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.tar.bz2 sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.zip |
• overall replacement of:
[aString appendString:[NSString stringWithFormat:]] by
[aString appendFormat:]
since it's much more faster
• first look at loop where several [aStr appendString:] occur to try to combine them into one appendString or appendFormat since the allocation of memory takes really time
Note: I tested all my changes but we should test it further to be sure that I didn't a mistake!
Diffstat (limited to 'Source/SPQueryController.m')
-rw-r--r-- | Source/SPQueryController.m | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index c142ed3f..7a70573e 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -217,24 +217,17 @@ static SPQueryController *sharedQueryController = nil; { if (i < [messagesVisibleSet count]) { SPConsoleMessage *message = NSArrayObjectAtIndex(messagesVisibleSet, i); - + // If the timestamp column is not hidden we need to include them in the copy - if (!dateColumnIsHidden) { - [string appendString:@"/* "]; - [string appendString:[dateFormatter stringFromDate:[message messageDate]]]; - if (connectionColumnIsHidden) [string appendString:@" */ "]; - else [string appendString:@" "]; - } + if (!dateColumnIsHidden) + [string appendFormat:@"/* %@ %@ ", [dateFormatter stringFromDate:[message messageDate]], (connectionColumnIsHidden) ? @"*/ ": @""]; + // If the connection column is not hidden we need to include them in the copy - if (!connectionColumnIsHidden) { - if (dateColumnIsHidden) [string appendString:@"/* "]; - [string appendString:[message messageConnection]]; - [string appendString:@" */ "]; - } - - [string appendString:[message message]]; - [string appendString:@"\n"]; + if (!connectionColumnIsHidden) + [string appendFormat:@"%@%@ */ ",(dateColumnIsHidden) ? @"/* " : @"", [message messageConnection]]; + + [string appendFormat:@"%@\n", [message message]]; } i = [rows indexGreaterThanIndex:i]; @@ -916,22 +909,18 @@ static SPQueryController *sharedQueryController = nil; if (timeStamps || connections) [consoleString appendString:@"/* "]; // If the timestamp column is not hidden we need to include them in the copy - if (timeStamps) { - [consoleString appendString:[dateFormatter stringFromDate:[message messageDate]]]; - [consoleString appendString:@" "]; - } - + if (timeStamps) + [consoleString appendFormat:@"%@ ", [dateFormatter stringFromDate:[message messageDate]]]; + // If the connection column is not hidden we need to include them in the copy - if (connections) { - [consoleString appendString:[message messageConnection]]; - [consoleString appendString:@" "]; - } - + if (connections) + [consoleString appendFormat:@"%@ ", [message messageConnection]]; + // Close the comment if (timeStamps || connections) [consoleString appendString:@"*/ "]; - [consoleString appendString:[message message]]; - [consoleString appendString:@"\n"]; + [consoleString appendFormat:@"%@\n", [message message]]; + } return consoleString; |