zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #26880
[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.
Commit message:
Minor performance tweaks.
Fixed help message.
Fixed comment typo.
Requested reviews:
Paul J. Lucas (paul-lucas)
For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/213942
Minor performance tweaks.
Fixed help message.
Fixed comment typo.
--
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/213942
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'bin/zorbacmd_args.cpp'
--- bin/zorbacmd_args.cpp 2014-03-05 23:19:14 +0000
+++ bin/zorbacmd_args.cpp 2014-04-02 22:46:08 +0000
@@ -139,7 +139,7 @@
HELP_OPT( "--execute-plan" )
"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"
- HELP_OPT( "--external-variable, -e <name>{=file|:=<value>}" )
+ HELP_OPT( "--external-variable, -e <name>{=<file>|:=<value>}" )
"Set the value for an externsl variable.\n\n"
////////// f //////////////////////////////////////////////////////////////
=== modified file 'src/runtime/base/plan_iterator.h'
--- src/runtime/base/plan_iterator.h 2014-02-27 18:36:37 +0000
+++ src/runtime/base/plan_iterator.h 2014-04-02 22:46:08 +0000
@@ -491,7 +491,7 @@
if ( planState.profile_ ) {
//
// Temporaries are used here to guarantee the order in which the timers
- // are stopped. (If the expressions were passed as functio arguments,
+ // are stopped. (If the expressions were passed as function arguments,
// the order is platform/compiler-dependent.)
//
time::msec_type const ce( c.elapsed() );
=== modified file 'src/store/naive/json_items.cpp'
--- src/store/naive/json_items.cpp 2013-08-19 13:00:41 +0000
+++ src/store/naive/json_items.cpp 2014-04-02 22:46:08 +0000
@@ -288,7 +288,9 @@
bool accumulate)
{
ASSERT_INVARIANT();
- const char* lName = aName->getStringValue().c_str();
+ zstring zname;
+ aName->getStringValue2( zname );
+ const char *const lName = zname.c_str();
Keys::iterator ite = theKeys.find(lName);
@@ -298,13 +300,12 @@
if (getCollection() != NULL && (aValue->isStructuredItem()))
{
- assert(dynamic_cast<StructuredItem*>(aValue.getp()));
+ assert( dynamic_cast<StructuredItem*>(lValue) );
StructuredItem* lStructuredItem = static_cast<StructuredItem*>(aValue.getp());
lStructuredItem->setCollectionTreeInfo(theCollectionInfo);
}
- csize lPosition = thePairs.size();
- theKeys.insert(std::make_pair(lName, lPosition));
+ theKeys.insert( std::make_pair( lName, thePairs.size() ) );
thePairs.push_back(std::make_pair(aName.getp(), lValue));
aName->addReference();
lValue->addReference();
@@ -314,7 +315,7 @@
}
else if (accumulate)
{
- csize lPosition = ite->second;
+ size_type lPosition = ite->second;
assert(thePairs[lPosition].first->getStringValue() == lName);
@@ -355,21 +356,20 @@
{
ASSERT_INVARIANT();
- const char* lName = aName->getStringValue().c_str();
- store::Item_t lValue;
+ zstring zname;
+ aName->getStringValue2( zname );
+ const char *const lName = zname.c_str();
Keys::iterator lIter = theKeys.find(lName);
if (lIter == theKeys.end())
{
ASSERT_INVARIANT();
- return 0;
+ return NULL;
}
- csize lPosition = lIter->second;
+ size_type lPosition = lIter->second;
- store::Item* lKey;
-
- lKey = thePairs[lPosition].first;
- lValue = thePairs[lPosition].second;
+ store::Item *const lKey = thePairs[lPosition].first;
+ store::Item_t lValue( thePairs[lPosition].second );
if (getCollection() != NULL && (lValue->isStructuredItem()))
{
@@ -390,7 +390,7 @@
Keys::iterator lKeysEnd = theKeys.end();
for (; lKeysIte != lKeysEnd; ++lKeysIte)
{
- csize lPos = lKeysIte->second;
+ size_type lPos = lKeysIte->second;
if (lPos > lPosition)
{
lKeysIte->second = lPos - 1;
@@ -411,7 +411,9 @@
const store::Item_t& aValue)
{
ASSERT_INVARIANT();
- const char* lName = aName->getStringValue().c_str();
+ zstring zname;
+ aName->getStringValue2( zname );
+ const char *const lName = zname.c_str();
Keys::const_iterator lIter = theKeys.find(lName);
if (lIter == theKeys.end())
@@ -419,7 +421,7 @@
ASSERT_INVARIANT();
return 0;
}
- csize lPosition = lIter->second;
+ size_type lPosition = lIter->second;
assert(thePairs[lPosition].first->getStringValue() == lName);
@@ -461,8 +463,11 @@
const store::Item_t& aNewName)
{
ASSERT_INVARIANT();
- const char* lName = aName->getStringValue().c_str();
- const char* lNewName = aNewName->getStringValue().c_str();
+ zstring zname, znewname;
+ aName->getStringValue2( zname );
+ aNewName->getStringValue2( znewname );
+ const char *const lName = zname.c_str();
+ const char *const lNewName = znewname.c_str();
Keys::const_iterator lIter = theKeys.find(lNewName);
if (lIter != theKeys.end())
@@ -479,7 +484,7 @@
return false;
}
- csize lPosition = ite->second;
+ size_type lPosition = ite->second;
assert(thePairs[lPosition].first->getStringValue() == lName);
thePairs[lPosition].first->removeReference();
@@ -544,7 +549,6 @@
*******************************************************************************/
void SimpleJSONObject::getStringValue2(zstring& val) const
{
- ASSERT_INVARIANT();
val = getStringValue();
}
@@ -554,7 +558,6 @@
*******************************************************************************/
void SimpleJSONObject::appendStringValue(zstring& buf) const
{
- ASSERT_INVARIANT();
buf = getStringValue();
}
@@ -575,7 +578,9 @@
store::Item_t SimpleJSONObject::getObjectValue(const store::Item_t& aKey) const
{
ASSERT_INVARIANT();
- const char* lName = aKey->getStringValue().c_str();
+ zstring zname;
+ aKey->getStringValue2( zname );
+ const char *const lName = zname.c_str();
Keys::const_iterator lIter = theKeys.find(lName);
@@ -583,7 +588,7 @@
{
return NULL;
}
- csize lPosition = lIter->second;
+ size_type lPosition = lIter->second;
assert(thePairs[lPosition].first->getStringValue() == lName);
@@ -624,7 +629,7 @@
lIter != theKeys.end();
++lIter)
{
- csize lPosition = lIter->second;
+ size_type lPosition = lIter->second;
assert(lPosition < thePairs.size());
assert(thePairs[lPosition].first != NULL);
assert(thePairs[lPosition].first->isAtomic());
=== modified file 'src/store/naive/json_items.h'
--- src/store/naive/json_items.h 2013-08-29 17:44:25 +0000
+++ src/store/naive/json_items.h 2014-04-02 22:46:08 +0000
@@ -209,14 +209,15 @@
class SimpleJSONObject : public JSONObject
{
protected:
+ typedef std::vector<std::pair<store::Item*, store::Item*> > Pairs;
+ typedef Pairs::size_type size_type;
+
typedef std::unordered_map<
const char*,
- csize,
+ size_type,
ztd::hash<char const*>,
ztd::equal_to<char const*> > Keys;
- typedef std::vector<std::pair<store::Item*, store::Item*> > Pairs;
-
class KeyIterator : public store::Iterator
{
protected:
Follow ups