Skip to content


Performance improvement for default now return #3

merged 1 commit into from

2 participants


This is a quick modification that looks up the now value only if the transformedValue is nil when it's about to be returned. In our app, Couple, we noticed a slowdown from the repetitive lookup of the now value at every relative date transform which happens a lot when you scroll through our timeline of messages.


Actually, hold on with the merge, there are a few issues with the code and it pulled in an extra commit I didn't intend to add.


Ok, it's ready to go now - the commit should be clean.

@billgarrison billgarrison merged commit b19570d into billgarrison:master

Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 3, 2013
  1. @michaelpetrov
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 SORelativeDateTransformer/SORelativeDateTransformer.m
8 SORelativeDateTransformer/SORelativeDateTransformer.m
@@ -76,9 +76,7 @@ - (id) transformedValue:(id)value
return SORelativeDateLocalizedString(@"now", @"label for current date-time");
- // Default return value is "now".
- id transformedValue = SORelativeDateLocalizedString(@"now", @"label for current date-time");
+ id transformedValue = nil;
// Obtain the date components for the relative difference between the input date and now.
@@ -142,6 +140,10 @@ - (id) transformedValue:(id)value
} // for loop
+ // Default return value is "now".
+ if (!transformedValue) {
+ transformedValue = SORelativeDateLocalizedString(@"now", @"label for current date-time");
+ }
return transformedValue;
Something went wrong with that request. Please try again.