Merge lp:~zorba-coders/zorba/collection-insert-without-copy into lp:zorba

Proposed by Matthias Brantner on 2012-05-08
Status: Merged
Approved by: Markos Zaharioudakis on 2012-05-09
Approved revision: 10829
Merged at revision: 10830
Proposed branch: lp:~zorba-coders/zorba/collection-insert-without-copy
Merge into: lp:zorba
Diff against target: 130 lines (+30/-2)
6 files modified
ChangeLog (+4/-0)
src/compiler/translator/translator.cpp (+1/-1)
src/runtime/base/plan_iterator.h (+2/-0)
src/runtime/collections/collections_base.h (+3/-0)
src/runtime/core/constructors.h (+12/-0)
src/store/naive/node_items.cpp (+8/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/collection-insert-without-copy
Reviewer Review Type Date Requested Status
Markos Zaharioudakis 2012-05-08 Approve on 2012-05-09
Matthias Brantner Approve on 2012-05-08
Review via email: mp+105148@code.launchpad.net

This proposal supersedes a proposal from 2012-05-08.

Commit Message

no node copying during insertion into collection if the nodes are freshly constructed nodes

Description of the Change

no node copying during insertion into collection if the nodes are freshly constructed nodes

To post a comment you must log in.
Matthias Brantner (matthias-brantner) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Markos Zaharioudakis (markos-za) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/collection-insert-without-copy into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job
  collection-insert-without-copy-2012-05-08T22-02-17.793Z is finished. The
  final status was:

  546 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job collection-insert-without-copy-2012-05-08T23-35-58.8Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve, 2 Pending.

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job collection-insert-without-copy-2012-05-09T00-13-03.711Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-05-07 23:43:04 +0000
3+++ ChangeLog 2012-05-08 23:34:21 +0000
4@@ -25,6 +25,10 @@
5 * Added XQJ support.
6 * Added CollectionManager and DocumentManager support for XQJ.
7
8+Optimizations:
9+ * optimized insertion into a collection (don't copy it if the node was created by an element constructor
10+ and is not used anywhere else in the query
11+
12 Bug Fixes/Other Changes:
13 * Fixed bugs #931501 and #866987 (improved error messages for fn:format-number(). Additionally, the function now throws the FODF1310 error instead of XTDE1310, as the 3.0 spec requires)
14 * Fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
15
16=== modified file 'src/compiler/translator/translator.cpp'
17--- src/compiler/translator/translator.cpp 2012-05-05 02:39:12 +0000
18+++ src/compiler/translator/translator.cpp 2012-05-08 23:34:21 +0000
19@@ -2195,7 +2195,7 @@
20 {
21 TRACE_VISIT();
22
23- if (v.get_encoding().length() != 0 &&
24+ if (v.get_encoding() != "utf-8" &&
25 !utf8::match_whole(v.get_encoding(), "^[A-Za-z]([A-Za-z0-9._]|[-])*$"))
26 RAISE_ERROR(err::XQST0087, loc, ERROR_PARAMS(v.get_encoding()));
27
28
29=== modified file 'src/runtime/base/plan_iterator.h'
30--- src/runtime/base/plan_iterator.h 2012-05-03 12:31:51 +0000
31+++ src/runtime/base/plan_iterator.h 2012-05-08 23:34:21 +0000
32@@ -346,6 +346,8 @@
33
34 TypeManager* getTypeManager() const;
35
36+ virtual bool isConstructor() const { return false; }
37+
38 /**
39 * Accept method for the PlanIterator-Tree-Visitor
40 *
41
42=== modified file 'src/runtime/collections/collections_base.h'
43--- src/runtime/collections/collections_base.h 2012-05-03 12:31:51 +0000
44+++ src/runtime/collections/collections_base.h 2012-05-08 23:34:21 +0000
45@@ -128,6 +128,9 @@
46
47 getCopyMode(lCopyMode, this->theSctx);
48
49+ lCopyMode.theDoCopy = !
50+ this->theChildren[this->theChildren.size()-1]->isConstructor();
51+
52 while (this->consumeNext(node, this->theChildren[this->theChildren.size()-1].getp(), planState))
53 {
54 checkNodeType(this->theSctx, node, collectionDecl, this->loc, theDynamicCollection);
55
56=== modified file 'src/runtime/core/constructors.h'
57--- src/runtime/core/constructors.h 2012-05-03 12:31:51 +0000
58+++ src/runtime/core/constructors.h 2012-05-08 23:34:21 +0000
59@@ -67,6 +67,8 @@
60
61 bool copyInputNodes() const { return theCopyInputNodes; }
62
63+ bool isConstructor() const { return true; }
64+
65 void accept(PlanIterVisitor& v) const;
66
67 void openImpl(PlanState& planState, uint32_t& offset);
68@@ -141,6 +143,8 @@
69
70 bool copyInputNodes() const { return theCopyInputNodes; }
71
72+ bool isConstructor() const { return true; }
73+
74 uint32_t getStateSizeOfSubtree() const;
75
76 void accept(PlanIterVisitor&) const;
77@@ -193,6 +197,8 @@
78
79 store::Item* getQName() const { return theQName.getp(); }
80
81+ bool isConstructor() const { return true; }
82+
83 void accept(PlanIterVisitor& v) const;
84
85 bool nextImpl(store::Item_t& result, PlanState& planState) const;
86@@ -234,6 +240,8 @@
87 PlanIter_t& aChild,
88 bool isRoot);
89
90+ bool isConstructor() const { return true; }
91+
92 void accept(PlanIterVisitor& v) const;
93
94 bool nextImpl(store::Item_t& result, PlanState& planState) const;
95@@ -275,6 +283,8 @@
96 PlanIter_t& aComment,
97 bool isRoot);
98
99+ bool isConstructor() const { return true; }
100+
101 void accept(PlanIterVisitor& v) const;
102
103 bool nextImpl(store::Item_t& result, PlanState& planState) const;
104@@ -314,6 +324,8 @@
105 PlanIter_t& aContent,
106 bool isRoot);
107
108+ bool isConstructor() const { return true; }
109+
110 void accept(PlanIterVisitor& v) const;
111
112 bool nextImpl(store::Item_t& result, PlanState& planState) const;
113
114=== modified file 'src/store/naive/node_items.cpp'
115--- src/store/naive/node_items.cpp 2012-05-03 12:31:51 +0000
116+++ src/store/naive/node_items.cpp 2012-05-08 23:34:21 +0000
117@@ -615,7 +615,14 @@
118 }
119 } // have parent
120
121- return copyInternal(parent, parent, pos, NULL, copymode);
122+ if (copymode.theDoCopy)
123+ {
124+ return copyInternal(parent, parent, pos, NULL, copymode);
125+ }
126+ else
127+ {
128+ return const_cast<XmlNode*>(this);
129+ }
130 }
131
132

Subscribers

People subscribed via source and target branches