Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Paul J. Lucas
Approved revision: 11490
Merged at revision: 11710
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 214 lines (+35/-29)
4 files modified
bin/zorbacmd_args.cpp (+1/-1)
src/runtime/base/plan_iterator.h (+1/-1)
src/store/naive/json_items.cpp (+29/-24)
src/store/naive/json_items.h (+4/-3)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+213942@code.launchpad.net

Commit message

Minor performance tweaks.
Fixed help message.
Fixed comment typo.

Description of the change

Minor performance tweaks.
Fixed help message.
Fixed comment typo.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/213942

Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/zorbacmd_args.cpp'
2--- bin/zorbacmd_args.cpp 2014-03-05 23:19:14 +0000
3+++ bin/zorbacmd_args.cpp 2014-04-02 22:46:08 +0000
4@@ -139,7 +139,7 @@
5 HELP_OPT( "--execute-plan" )
6 "Do not compile the query; instead load the execution plan from the file specified by the -f -q options (or by any file specified without any other argument), and execute the loaded plan.\n\n"
7
8- HELP_OPT( "--external-variable, -e <name>{=file|:=<value>}" )
9+ HELP_OPT( "--external-variable, -e <name>{=<file>|:=<value>}" )
10 "Set the value for an externsl variable.\n\n"
11
12 ////////// f //////////////////////////////////////////////////////////////
13
14=== modified file 'src/runtime/base/plan_iterator.h'
15--- src/runtime/base/plan_iterator.h 2014-02-27 18:36:37 +0000
16+++ src/runtime/base/plan_iterator.h 2014-04-02 22:46:08 +0000
17@@ -491,7 +491,7 @@
18 if ( planState.profile_ ) {
19 //
20 // Temporaries are used here to guarantee the order in which the timers
21- // are stopped. (If the expressions were passed as functio arguments,
22+ // are stopped. (If the expressions were passed as function arguments,
23 // the order is platform/compiler-dependent.)
24 //
25 time::msec_type const ce( c.elapsed() );
26
27=== modified file 'src/store/naive/json_items.cpp'
28--- src/store/naive/json_items.cpp 2013-08-19 13:00:41 +0000
29+++ src/store/naive/json_items.cpp 2014-04-02 22:46:08 +0000
30@@ -288,7 +288,9 @@
31 bool accumulate)
32 {
33 ASSERT_INVARIANT();
34- const char* lName = aName->getStringValue().c_str();
35+ zstring zname;
36+ aName->getStringValue2( zname );
37+ const char *const lName = zname.c_str();
38
39 Keys::iterator ite = theKeys.find(lName);
40
41@@ -298,13 +300,12 @@
42
43 if (getCollection() != NULL && (aValue->isStructuredItem()))
44 {
45- assert(dynamic_cast<StructuredItem*>(aValue.getp()));
46+ assert( dynamic_cast<StructuredItem*>(lValue) );
47 StructuredItem* lStructuredItem = static_cast<StructuredItem*>(aValue.getp());
48 lStructuredItem->setCollectionTreeInfo(theCollectionInfo);
49 }
50
51- csize lPosition = thePairs.size();
52- theKeys.insert(std::make_pair(lName, lPosition));
53+ theKeys.insert( std::make_pair( lName, thePairs.size() ) );
54 thePairs.push_back(std::make_pair(aName.getp(), lValue));
55 aName->addReference();
56 lValue->addReference();
57@@ -314,7 +315,7 @@
58 }
59 else if (accumulate)
60 {
61- csize lPosition = ite->second;
62+ size_type lPosition = ite->second;
63
64 assert(thePairs[lPosition].first->getStringValue() == lName);
65
66@@ -355,21 +356,20 @@
67 {
68 ASSERT_INVARIANT();
69
70- const char* lName = aName->getStringValue().c_str();
71- store::Item_t lValue;
72+ zstring zname;
73+ aName->getStringValue2( zname );
74+ const char *const lName = zname.c_str();
75
76 Keys::iterator lIter = theKeys.find(lName);
77 if (lIter == theKeys.end())
78 {
79 ASSERT_INVARIANT();
80- return 0;
81+ return NULL;
82 }
83- csize lPosition = lIter->second;
84+ size_type lPosition = lIter->second;
85
86- store::Item* lKey;
87-
88- lKey = thePairs[lPosition].first;
89- lValue = thePairs[lPosition].second;
90+ store::Item *const lKey = thePairs[lPosition].first;
91+ store::Item_t lValue( thePairs[lPosition].second );
92
93 if (getCollection() != NULL && (lValue->isStructuredItem()))
94 {
95@@ -390,7 +390,7 @@
96 Keys::iterator lKeysEnd = theKeys.end();
97 for (; lKeysIte != lKeysEnd; ++lKeysIte)
98 {
99- csize lPos = lKeysIte->second;
100+ size_type lPos = lKeysIte->second;
101 if (lPos > lPosition)
102 {
103 lKeysIte->second = lPos - 1;
104@@ -411,7 +411,9 @@
105 const store::Item_t& aValue)
106 {
107 ASSERT_INVARIANT();
108- const char* lName = aName->getStringValue().c_str();
109+ zstring zname;
110+ aName->getStringValue2( zname );
111+ const char *const lName = zname.c_str();
112
113 Keys::const_iterator lIter = theKeys.find(lName);
114 if (lIter == theKeys.end())
115@@ -419,7 +421,7 @@
116 ASSERT_INVARIANT();
117 return 0;
118 }
119- csize lPosition = lIter->second;
120+ size_type lPosition = lIter->second;
121
122 assert(thePairs[lPosition].first->getStringValue() == lName);
123
124@@ -461,8 +463,11 @@
125 const store::Item_t& aNewName)
126 {
127 ASSERT_INVARIANT();
128- const char* lName = aName->getStringValue().c_str();
129- const char* lNewName = aNewName->getStringValue().c_str();
130+ zstring zname, znewname;
131+ aName->getStringValue2( zname );
132+ aNewName->getStringValue2( znewname );
133+ const char *const lName = zname.c_str();
134+ const char *const lNewName = znewname.c_str();
135
136 Keys::const_iterator lIter = theKeys.find(lNewName);
137 if (lIter != theKeys.end())
138@@ -479,7 +484,7 @@
139 return false;
140 }
141
142- csize lPosition = ite->second;
143+ size_type lPosition = ite->second;
144 assert(thePairs[lPosition].first->getStringValue() == lName);
145
146 thePairs[lPosition].first->removeReference();
147@@ -544,7 +549,6 @@
148 *******************************************************************************/
149 void SimpleJSONObject::getStringValue2(zstring& val) const
150 {
151- ASSERT_INVARIANT();
152 val = getStringValue();
153 }
154
155@@ -554,7 +558,6 @@
156 *******************************************************************************/
157 void SimpleJSONObject::appendStringValue(zstring& buf) const
158 {
159- ASSERT_INVARIANT();
160 buf = getStringValue();
161 }
162
163@@ -575,7 +578,9 @@
164 store::Item_t SimpleJSONObject::getObjectValue(const store::Item_t& aKey) const
165 {
166 ASSERT_INVARIANT();
167- const char* lName = aKey->getStringValue().c_str();
168+ zstring zname;
169+ aKey->getStringValue2( zname );
170+ const char *const lName = zname.c_str();
171
172 Keys::const_iterator lIter = theKeys.find(lName);
173
174@@ -583,7 +588,7 @@
175 {
176 return NULL;
177 }
178- csize lPosition = lIter->second;
179+ size_type lPosition = lIter->second;
180
181 assert(thePairs[lPosition].first->getStringValue() == lName);
182
183@@ -624,7 +629,7 @@
184 lIter != theKeys.end();
185 ++lIter)
186 {
187- csize lPosition = lIter->second;
188+ size_type lPosition = lIter->second;
189 assert(lPosition < thePairs.size());
190 assert(thePairs[lPosition].first != NULL);
191 assert(thePairs[lPosition].first->isAtomic());
192
193=== modified file 'src/store/naive/json_items.h'
194--- src/store/naive/json_items.h 2013-08-29 17:44:25 +0000
195+++ src/store/naive/json_items.h 2014-04-02 22:46:08 +0000
196@@ -209,14 +209,15 @@
197 class SimpleJSONObject : public JSONObject
198 {
199 protected:
200+ typedef std::vector<std::pair<store::Item*, store::Item*> > Pairs;
201+ typedef Pairs::size_type size_type;
202+
203 typedef std::unordered_map<
204 const char*,
205- csize,
206+ size_type,
207 ztd::hash<char const*>,
208 ztd::equal_to<char const*> > Keys;
209
210- typedef std::vector<std::pair<store::Item*, store::Item*> > Pairs;
211-
212 class KeyIterator : public store::Iterator
213 {
214 protected:

Subscribers

People subscribed via source and target branches