boredzo / iso-8601-date-formatter

A Cocoa NSFormatter subclass to convert dates to and from ISO-8601-formatted strings. Supports calendar, week, and ordinal formats.
http://boredzo.org/iso8601dateformatter/
Other
600 stars 140 forks source link

Simplify code by using copy-on-write for the immutable time zone cache #38

Closed steipete closed 9 years ago

steipete commented 10 years ago

Simplify code by using copy-on-write for the immutable time zone cache dictionary instead of a slower thread local variant.

This references #12 and runs about 15% faster in my quick test. It's also a lot less code and especially no longer needs an initializer to create the cache.

Another way that might be not as fast but would require even less memory would be to simply use an NSCache object instead of the NSDictionary.

steipete commented 10 years ago

I felt motivated today and made another pull request that solves this problem via NSCache. It's even better. https://github.com/boredzo/iso-8601-date-formatter/pull/39

boredzo commented 9 years ago

I went with #39. Thanks!