Closed jkubicek closed 13 years ago
Nice work, sir. Just tried it out on Codebook, looks good, just merged and pushed your pull request. Thanks!
Well, this may not still be thread-safe, however I've updated the category on the develop branch to lazily load a single, static NSCalendar and NSDateFormatter for use, dramatically increasing performance. Uses dispatch_once() to avoid doing it over and over again. Appears to work, you can see the commit here:
https://github.com/billymeltdown/nsdate-helper/commit/eff44b2a9a6e07a53a2db981612302e8f0cc062b
Circling back here: I just pushed to master what I've been using for a little bit on develop branch—using dispatch_once to initialize static variables for NSDateCalendar and NSDateFormatter.
I'm performing about 200+ date formats at the same time. Moving the calendar and dateFormatter into static variables and initializing them just once improved performance by a significant amount.