adium 3630:e820c84b5b98: Patch from an anonymous source improvin...
commits at adium.im
commits at adium.im
Wed Jan 26 00:58:54 UTC 2011
details: http://hg.adium.im/adium/rev/e820c84b5b98
revision: 3630:e820c84b5b98
author: Evan Schoenberg
date: Tue Jan 25 18:58:45 2011 -0600
Patch from an anonymous source improving performance of date parsing, which in turn provides a 40% speed boost in +[AILoggerPlugin sortedArrayOfLogFilesForChat:]
diffs (21 lines):
diff -r 363f9441891b -r e820c84b5b98 Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.m
--- a/Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.m Thu Jan 20 13:57:02 2011 -0500
+++ b/Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.m Tue Jan 25 18:58:45 2011 -0600
@@ -565,7 +565,16 @@
if(negative) tz_minute = -tz_minute;
}
- timeZone = [NSTimeZone timeZoneForSecondsFromGMT:(tz_hour * 3600) + (tz_minute * 60)];
+ NSInteger secondsFromGMT = (tz_hour * 3600) + (tz_minute * 60);
+ static NSInteger lastUsedSecondsFromGMT = NSNotFound;
+ static NSTimeZone *lastUsedTimeZone;
+ if (secondsFromGMT == lastUsedSecondsFromGMT)
+ timeZone = [[lastUsedTimeZone retain] autorelease];
+ else
+ timeZone = [NSTimeZone timeZoneForSecondsFromGMT:secondsFromGMT];
+ lastUsedSecondsFromGMT = secondsFromGMT;
+ [lastUsedTimeZone autorelease];
+ lastUsedTimeZone = [timeZone retain];
}
}
}
More information about the commits
mailing list