Commit Graph

34 Commits

Author SHA1 Message Date
Paween Itthipalkul
4d6b867ae2 Add SHORT_NUMBER_SUPPORT define when initializing _shortNumberMetadataCache 2018-02-20 13:27:33 -08:00
Paween Itthipalkul
47f20db73d Updated PR to respond to review comments
- Removed NSLog in NBPhoneNumberParsingPerfTest
- Converted isNan from a method to a function.
- isNan is now only checking for integer value instead of a float, as the intended use for the function is to remove non-geological calling code, which can only be an integer.
2018-02-20 11:26:43 -08:00
Paween Itthipalkul
b0f3a6bcec Improve phone number parsing performance ~10-15%
Improve phone number parsing performance by:
- Using NSCache to cache metadata, so when parsing phone numbers from different regions, the metadata cache is still going to be valid.
- Improve various methods in NBPhoneNumberUtil by removing redundant operations, or using a different construct that’s more performant (such as using NSCharacterSet instead of NSScanner to check if a string is a number).

Also added a performance test that reads sample phone numbers from the metadata, and parse them.

Performance improvement result:
Machine:
Mac Pro (Late 2013)
2.7 GHz. 12-Core Intel Xeon E5
64 GB 1866 MHz DDR3
macOS High Sierra 10.13.3

Phone number to parse count: 2688

Baseline (5 runs -- in seconds):
0.362
0.372
0.385
0.363
0.365

After Change (5 runs -- in seconds):
0.312 (14% faster)
0.315 (13% faster)
0.317 (12% faster)
0.327 (10% faster)
0.308 (15% faster)
2018-02-16 15:48:30 -08:00
Paween Itthipalkul
d2e0056f36 Improve phone number parsing performance ~10-14%
Improve phone number parsing performance by:
- Using NSCache to cache metadata, so when parsing phone numbers from different regions, the metadata cache is still going to be valid.
- Improve various methods in NBPhoneNumberUtil by removing redundant operations, or using a different construct that’s more performant (such as using NSCharacterSet instead of NSScanner to check if a string is a number).

Also added a performance test that reads sample phone numbers from the metadata, and parse them.

Performance improvement result:
Machine:
Mac Pro (Late 2013)
2.7 GHz. 12-Core Intel Xeon E5
64 GB 1866 MHz DDR3
macOS High Sierra 10.13.3

Phone number to parse count: 2688

Baseline (5 runs -- in seconds):
0.362
0.372
0.385
0.363
0.365

After Change (5 runs -- in seconds):
Serial Parsing:
0.312 (14% faster)
0.315 (13% faster)
0.317 (12% faster)
0.327 (10% faster)
0.317 (12% faster)
2018-02-16 14:47:15 -08:00
Paween Itthipalkul
13479163c8 Polish NBRegularExpressionCache/NBMetadataHelper
- Add NSError ** parameter to -[NBRegularExpressionCache regularExpressionForPattern:error] method.
- Consolidating the expansion of gzipped data into one method.
2018-01-19 11:08:12 -08:00
Paween Itthipalkul
c2a70f7187 Merge branch 'shortNumber' of https://github.com/paween/libPhoneNumber-iOS into shortNumber
# Conflicts:
#	libPhoneNumber.xcodeproj/project.pbxproj
#	libPhoneNumber/Internal/NBRegExMatcher.m
#	libPhoneNumber/Internal/NBRegularExpressionCache.m
#	libPhoneNumber/NBPhoneMetaData.h
#	libPhoneNumber/NBPhoneMetaData.m
#	libPhoneNumber/NBPhoneNumberUtil+ShortNumber.m
#	libPhoneNumber/NBPhoneNumberUtil.m
#	libPhoneNumberTests/NBPhoneNumberUtil+ShortNumberTestHelper.m
2017-12-18 12:52:49 -08:00
Paween Itthipalkul
c6fde0103c Add support for short number and emegerncy number in libPhoneNumber-iOS
This is a port of ShortNumberInfo class from Java version of libPhoneNumber into a category on NBPhoneNumberUtil class
2017-12-18 12:45:33 -08:00
Paween Itthipalkul
79bb46ba89 Add support for short number and emegerncy number in libPhoneNumber-iOS
This is a port of ShortNumberInfo class from Java version of libPhoneNumber into a category on NBPhoneNumberUtil class
2017-12-18 12:44:14 -08:00
Paween Itthipalkul
d837de6dfb Add support for short number and emegerncy number in libPhoneNumber-iOS
This is a port of ShortNumberInfo class from Java version of libPhoneNumber into a category on NBPhoneNumberUtil class
2017-12-04 11:11:18 -08:00
Dave MacLachlan
ee9ead6cab Standardize formatting across files using
clang-format -style=Google
2017-11-18 16:11:20 -08:00
Dave MacLachlan
3690579fa9 General Cleanup
Move some class methods to statics so they can be inlined.
Clean up some bad code.
2017-10-31 15:48:37 -07:00
Dave MacLachlan
d136f8da26 Merge branch 'master' into EnhancedMetadata 2017-06-15 09:28:10 -07:00
Dave MacLachlan
c4354f6802 Merge branch 'master' of github.com:iziz/libPhoneNumber-iOS 2017-06-09 15:11:47 -07:00
dmaclach
5d8b6f6f4a Merge branch 'master' into Remove-Metadata-App 2017-06-09 14:28:00 -07:00
Dave MacLachlan
62d81c00ff Move tests out of single test methods into individual methods 2017-06-09 10:10:08 -07:00
Ng Hui Qin
ea05dbbf3e add solution to get country name in iOS8 2017-06-08 07:56:58 +08:00
Dave MacLachlan
2ad246fd80 Remove unused method (stringByTrimming) 2017-03-20 12:27:51 -07:00
Dave MacLachlan
5fcfb550c0 Increase performance tremendously when parsing a lot of phone numbers 2017-03-20 12:00:46 -07:00
iziz
9d310efe15 test 3 2017-03-21 02:50:30 +09:00
iziz
d84fe09701 Test 2 2017-03-21 01:34:19 +09:00
Dave MacLachlan
84e3a684e5 Revamp script step to remove it from build steps in xcodeproject to having it run by hand to generate NBGeneratedPhoneNumberMetaData.h 2017-03-17 17:11:00 -07:00
Dave MacLachlan
d7869c2322 Move to using compressed JSON for Metadata 2017-03-17 17:11:00 -07:00
iziz
7572eb5b43 Cleanup and Rebuild schemes and it frameworks name & Update metadata with 7.7.5 2016-11-27 00:14:04 +09:00
ishtar
58b7ed2c15 Implement missing specs 2016-10-10 09:19:55 +09:00
crontab
354a8c0bd1 Force linkage of NBMetadataCore.m
Useful when linking the lib files statically, or linking against a
static libPhoneNumber
2016-01-31 20:41:46 +00:00
Tiago Veloso
f444d29a5c Added support for getting the supported regions 2015-08-03 11:55:44 +01:00
tabby
a3c85e2611 UnittTest code only works in TESTING==1 2015-05-05 17:49:19 +09:00
tabby
c7826d7e3f add static mark to hasValue method in NBMetadataHelper 2015-03-03 01:13:59 +09:00
tabby
d986771999 NBPhoneMetaData simple cache (class member) 2015-03-03 01:08:46 +09:00
tabby
d71932aa98 Remove static method in NBMetadataHelper 2015-03-03 01:00:29 +09:00
tabby
e7c61db05e Static variable initialization. 2015-02-21 20:13:00 +09:00
iziz
8ff4d04c43 Update NBMetadataHelper.m 2015-02-21 19:54:04 +09:00
ishtar
59d1a60674 NBPhoneMetaData simple cache 2015-02-09 01:32:34 +09:00
ishtar
46e1718af6 MAJOR UPDATE - REMOVE plist file AND singleton methods. 2015-02-09 00:09:48 +09:00