From e585b9052e7d9fb5f3cc5fcfbb0501743de34eee Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 15 May 2017 16:09:00 -0400 Subject: [PATCH] remove checks for other country codes since it's expensive Unfortunately calls to `NBPhoneNumberUtil parse:defaultRegion:error` are not cheap, calling it with a bunch of permutations on every contact is too expensive to justify it's incremental value unless we can get upstream optimized. e.g. for US numbers this was 26 extra calls per phone number // FREEBIE --- src/Contacts/PhoneNumber.m | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/Contacts/PhoneNumber.m b/src/Contacts/PhoneNumber.m index 622a7c4f3..bf1df44e0 100644 --- a/src/Contacts/PhoneNumber.m +++ b/src/Contacts/PhoneNumber.m @@ -169,18 +169,6 @@ static NSString *const RPDefaultsKeyPhoneNumberCanonical = @"RPDefaultsKeyPhoneN callingCodeForLocalNumber, sanitizedString], [self defaultRegionCode]); - - // It's gratuitous to try all country codes associated with a given - // calling code, but it can't hurt and this isn't a performance - // hotspot. - NSArray *possibleLocalCountryCodes = [PhoneNumberUtil.sharedUtil - countryCodesFromCallingCode:[NSString stringWithFormat:@"+%@", callingCodeForLocalNumber]]; - for (NSString *countryCode in possibleLocalCountryCodes) { - tryParsingWithCountryCode([NSString stringWithFormat:@"+%@%@", - callingCodeForLocalNumber, - sanitizedString], - countryCode); - } } }