Many web services choose to return dates in something other than a unix timestamp (unfortunately).
Recently I set out trying to identify performance bottlenecks with a large import operation in our iOS app. Having tweaked most of the variables, I was surprised to find out that date parsing was actually one of the biggest bottlenecks….
vombat cleverly discovered that SQLite’s strftime function parses ISO-8601 (i.e. JSON) dates an order of magnitude faster than NSDateFormatter does, even with the overhead of having to generate and evaluate a SQL SELECT statement to run it.
I decided to go one step farther — I tweezed out the ~250 lines of C code from SQLite that implement the actual parsing, and got them to build independently. This adds another factor of 2x speed.
You can get the resulting code here. It’s pure C with no dependencies other than the standard C library.
vombat cleverly discovered that SQLite’s strftime function parses ISO-8601 (i.e. JSON) dates an order of magnitude...
Interesting
Interesting article that reflects the perks of knowing how to properly use SQLite.In tho case it is about converting...
Design by Simon Fletcher. Powered by Tumblr.
© Copyright 2010