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

#806 Add _conflicts to the document in the map function #822

Merged
merged 2 commits into from
Jul 27, 2015

Conversation

pasin
Copy link
Contributor

@pasin pasin commented Jul 23, 2015

  • When updating view index, gather a list of the conflict revisions if any.
  • Add index conflict docs performance test to View_Benchmarks.
  • Performance note when indexing 5000 documents, each has 0 conflict revisions (IP6 simulator):
SQLite:

Master branch:
[Time, seconds] average: 0.123, relative standard deviation: 4.698%, 
values: [0.137071, 0.118618, 0.122648, 0.118491, 0.119955, 0.130553, 0.125290, 0.121883, 0.118404, 0.120640]

_conflicts branch:
[Time, seconds] average: 0.127, relative standard deviation: 2.886%, 
values: [0.130026, 0.124279, 0.125534, 0.130044, 0.119877, 0.132092, 0.125637, 0.125442, 0.131264, 0.130175]

ForestDB:

Master branch:

[Time, seconds] average: 0.175, relative standard deviation: 0.806%, 
values: [0.173869, 0.176649, 0.173722, 0.175208, 0.176017, 0.172913, 0.175884, 0.172716, 0.174799, 0.176723]

_conflicts branch:
[Time, seconds] average: 0.172, relative standard deviation: 0.528%, 
values: [0.172850, 0.171485, 0.170446, 0.171153, 0.171059, 0.173832, 0.171988, 0.171561, 0.171765, 0.171921]
  • Performance note when indexing 5000 documents, each has 100 conflict revisions (IP6 simulator):
SQLite:

Master branch:
[Time, seconds] average: 2.791, relative standard deviation: 0.972%, 
values: [2.838544, 2.784327, 2.784880, 2.747793, 2.820985, 2.789743, 2.765956, 2.775347, 2.824352, 2.774947],

_conflicts branch:
[Time, seconds] average: 3.039, relative standard deviation: 1.005%, 
values: [3.006172, 3.016779, 3.045371, 3.102432, 2.997188, 3.058586, 3.067990, 3.012772, 3.043481, 3.044008]

ForestDB:

Master branch:
[Time, seconds] average: 0.587, relative standard deviation: 0.885%, 
values: [0.580759, 0.590165, 0.585337, 0.583715, 0.588333, 0.588271, 0.585275, 0.585258, 0.583447, 0.600625], 

_conflicts branch:
[Time, seconds] average: 1.016, relative standard deviation: 8.155%, values: [1.261900, 0.983670, 0.984249, 0.984583, 0.984473, 0.980027, 0.984079, 1.019412, 0.988718, 0.984164]

** Update : Add Performance result for indexing 5000 docs without conflicts.
#806

- When updating view index, gather a list of the conflict revisions if any.

- Add index conflict docs performance test to View_Benchmarks.
@pasin
Copy link
Contributor Author

pasin commented Jul 24, 2015

With some possible perf cost, what do you think about overloading setMapBlock method with an option param (having a property to include _conflicts) to setMapBlock so by default the doc will not include _conficts?

@@ -92,7 +92,10 @@ virtual void addDocument(const Document& cppDoc) {
const Revision* node = vdoc.currentRevision();
NSMutableDictionary* body = [CBLForestBridge bodyOfNode: node];
body[@"_local_seq"] = @(node->sequence);

NSArray* conflicts = [CBLForestBridge getCurrentRevisionIDs: vdoc];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can wrap this new code with if (vdoc.isConflicted()) { ... } to remove the overhead for docs without conflicts.

@snej
Copy link
Contributor

snej commented Jul 24, 2015

I'm not worried about slowing down view indexing in the case where there are conflicts, since conflicts shouldn't be common. I'm just worried about slowing down indexing for the regular case where there are no conflicts. If you add the change I suggested above, there shouldn't be any noticeable overhead. Could you benchmark with and without your patch to look for a regression?

@pasin
Copy link
Contributor Author

pasin commented Jul 24, 2015

Yes, I will do that.

@pasin
Copy link
Contributor Author

pasin commented Jul 24, 2015

I made change as suggested. The change now doesn't affect non-conflicts indexing performance.

snej added a commit that referenced this pull request Jul 27, 2015
Add _conflicts to the document in the map function
@snej snej merged commit 66e111c into master Jul 27, 2015
@snej snej deleted the feature/issue_806_map_conflicts branch July 27, 2015 23:16
@pasin pasin changed the title Add _conflicts to the document in the map function #806 Add _conflicts to the document in the map function Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants