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

Redesign stack context structure #60

Closed
jessesquires opened this issue Mar 2, 2016 · 3 comments
Closed

Redesign stack context structure #60

jessesquires opened this issue Mar 2, 2016 · 3 comments
Assignees
Milestone

Comments

@jessesquires
Copy link
Owner

After talking with Daniel Eggert, I found that nesting parent/child contexts is non-optimal.

Move from the existing stack architecture, to the following:

  • Remove mainContext as a child context of the backgroundContext
  • Connect both backgroundContext and mainContext to the coordinator
  • Merge via notification APIs

Original design: 28b9e4e (what we want to go back to)
Refactor to parent-child: f0aa87c

Basically need to revert stack changes in f0aa87c to go back to 28b9e4e

@jessesquires jessesquires self-assigned this Mar 2, 2016
@jessesquires jessesquires added this to the 3.0.0 milestone Mar 2, 2016
@jessesquires jessesquires modified the milestones: 4.0.0, 3.0.0 Mar 28, 2016
@jessesquires
Copy link
Owner Author

@TimurBK
Copy link

TimurBK commented Apr 8, 2016

I was actually quite surprised to find out that most of popular CoreData libraries use parent-child stack. On data set of hundreds it may add ~30% to fetch time(I got ~0.6s and by using main queue MOC directly connected to PSC I got 0.4s on iPhone 5).
Stack in Daniel's answer(probably can be called "classic") is performing much better. And if it's not enough, two separate persistent store coordinators connected to single store may help.

@jessesquires
Copy link
Owner Author

Definitely. After talking with Daniel, I learned that child contexts are really misunderstood and misused.

The best scenario is to use them as a scratch pad where you may want to completely throw out the objects.

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

No branches or pull requests

2 participants