Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify code by using NSCache for the time zone cache dictionary #39

Merged
merged 1 commit into from
Sep 8, 2015

Conversation

steipete
Copy link
Contributor

This is similar to #38, but uses an NSCache, which allows us to delete even more code. It's slightly slower than using the plain NSDictionary, but the difference is 0.001 sec on my machine, and it doesn't measure the benefits of not having to register for memory warnings. I'd go for that one.

…tead of a slower thread local variant. Also removes the requirement of registering for memory warnings as NSCache cleans up automatically.
steipete referenced this pull request in steipete/iso-8601-date-formatter Mar 27, 2014
…e dictionary instead of a slower thread local variant.
@ypresto
Copy link

ypresto commented Mar 19, 2015

I really want this PR to be merged, because it fixes thread-safety problem.
I have race condition (thread-safety) issue on v0.7.

Thread : Crashed: NSOperationQueue 0x1909cd80 :: NSOperation 0x191c9e10
0  CoreFoundation                 0x246eb138 -[__NSDictionaryM objectForKey:] + 195
1  CoreFoundation                 0x246eb0bd -[__NSDictionaryM objectForKey:] + 72
2  MayChannel                     0x001c0c27 -[ISO8601DateFormatter dateComponentsFromString:timeZone:range:fractionOfSecond:] (ISO8601DateFormatter.m:619)
3  MayChannel                     0x001c0f87 -[ISO8601DateFormatter dateFromString:timeZone:range:] (ISO8601DateFormatter.m:692)
4  MayChannel                     0x001c0f4b -[ISO8601DateFormatter dateFromString:timeZone:] (ISO8601DateFormatter.m:686)
Thread : NSOperationQueue 0x1909cd80 :: NSOperation 0x19026450
...
28 CoreFoundation                 0x24731039 -[__NSCFCalendar dateFromComponents:] + 1208
29 CoreFoundation                 0x24730ab5 -[_NSCopyOnWriteCalendarWrapper dateFromComponents:] + 148
30 MayChannel                     0x001c0fc9 -[ISO8601DateFormatter dateFromString:timeZone:range:] (ISO8601DateFormatter.m:701)
31 MayChannel                     0x001c0f4b -[ISO8601DateFormatter dateFromString:timeZone:] (ISO8601DateFormatter.m:686)

@steipete
Copy link
Contributor Author

Oh wow, I had no idea this wasn't merged yet. Doesn't look like the repo is still maintained.

@ypresto
Copy link

ypresto commented Mar 19, 2015

Oh... Is this project abandoned? > @boredzo

@boredzo
Copy link
Owner

boredzo commented Mar 21, 2015

It's not abandoned; I just have a to-do graph a mile wide. This project has still has a place in it, though.

@boredzo boredzo merged commit 98bf9cb into boredzo:master Sep 8, 2015
@boredzo
Copy link
Owner

boredzo commented Sep 8, 2015

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants