Re:Date parsing performance on iOS (NSDateformatter vs sqlite)
by MishraAnurag on Saturday September 07, 2013 @10:23AM
(#6345156)
Are you using mktime to get the unix timestamp? That might be the slower part as opposed to strptime.
[ Parent
| on HN ]
Re:Date parsing performance on iOS (NSDateformatter vs sqlite)
by jurre on Saturday September 07, 2013 @10:26AM
(#6345167)
I am, source is here: https://gist.github.com/jurre/6475263
My c is quite poor so if you have any suggestions on how to improve I'd love to hear them!
Re:Date parsing performance on iOS (NSDateformatter vs sqlite)
by MishraAnurag on Saturday September 07, 2013 @10:59AM
(#6345242)
I'd suggest using timegm instead of mktime, or set the TZ environment variable to UTC to ensure all implementations return an identical date. I ran the same tests and found that the strptime was quite fast, but gmtime was taking most of the time. To speed that up, you could borrow SQLite's implementation. Checkout the computeJD function from SQLite's date.c - http://www.sqlite.org/src/doc/trunk/src/date.c