{"id":7334,"date":"2013-04-18T14:34:07","date_gmt":"2013-04-18T19:34:07","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=7334"},"modified":"2013-05-13T15:27:03","modified_gmt":"2013-05-13T20:27:03","slug":"the-concurrent-core-data-stack","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2013\/04\/18\/the-concurrent-core-data-stack\/","title":{"rendered":"The Concurrent Core Data Stack"},"content":{"rendered":"<p><a href=\"http:\/\/floriankugler.com\/blog\/2013\/4\/2\/the-concurrent-core-data-stack\">Florian Kugler<\/a>:<\/p>\n<blockquote cite=\"http:\/\/floriankugler.com\/blog\/2013\/4\/2\/the-concurrent-core-data-stack\"><p>There is also a very clean flow of data from the worker contexts through the main context to the master context, which finally persists all changes. Since in this setup you never touch the master context, i.e. you never directly make changes to it, all changes flow through the main context. Therefore you will always have the latest data available on the main thread. No need for listening to change notifications and merging changes manually.<\/p><\/blockquote>\n<p>The key insight here is that managed object contexts in the same hierarchy can have different concurrency types. However it seems to me that this could potentially push a lot of work onto the main thread as fetches from that context would have to reconcile the differences between the disk and memory.<\/p>\n<p>Update (2013-04-29): <a href=\"http:\/\/floriankugler.com\/blog\/2013\/4\/29\/concurrent-core-data-stack-performance-shootout\">Florian Kugler<\/a>:<\/p>\n<blockquote cite=\"http:\/\/floriankugler.com\/blog\/2013\/4\/29\/concurrent-core-data-stack-performance-shootout\"><p>Core Data stack #3 with its independent managed object contexts blew the other two options out of the water. It literally crushed them. I didn&rsquo;t expect the nested setup #2 to be so much inferior.<\/p><\/blockquote>\n<p>Update (2013-05-13): <a href=\"http:\/\/floriankugler.com\/blog\/2013\/5\/11\/backstage-with-nested-managed-object-contexts\">Florian Kugler<\/a>:<\/p>\n<blockquote cite=\"http:\/\/floriankugler.com\/blog\/2013\/5\/11\/backstage-with-nested-managed-object-contexts\"><p>In this article I will take a look behind the scenes of how nested managed object contexts operate and explain why the performance of saving a child context often is much worse than manually merging changes into a context. Understanding how each approach works will make clear, that nested contexts are certainly not a replacement for &ldquo;manual&rdquo; merging.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Florian Kugler: There is also a very clean flow of data from the worker contexts through the main context to the master context, which finally persists all changes. Since in this setup you never touch the master context, i.e. you never directly make changes to it, all changes flow through the main context. Therefore you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,109,54,71],"class_list":["post-7334","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-coredata","tag-objective-c","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=7334"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7334\/revisions"}],"predecessor-version":[{"id":7420,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7334\/revisions\/7420"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=7334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=7334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=7334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}