Hacker News new | ask | show | jobs
by stevoski 4675 days ago
A class like NSDateFormatter is designed to handle a wide range of date formats. This usual results in sub-optimal performance. If you find it too slow and you have a known, specific date format you should write a specific fast parser.

I did the same with Java's Integer.parseInt(...) method. It is an interesting task to go through.

Now I'll spend the rest of this rainy afternoon playing around with writing a fast ISO date parser :)

Edit: Seems Java's Joda Time library already does parse ISO dates really quickly. 7 seconds for 4 million on my MBP

Edit: A fast custom date parser for ISO dates I just wrote can parse 4 million dates in 150 milliseconds.

2 comments

It does seem as though Apple should implement a separate optimized path for the very common case of ISO-8601 date formats.

Although I'm not sure how many people on iOS need millions of dates parsed.

So are you going to post that iso parser?