Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch 
into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/84487

small optimization of the group by
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/84487
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/context/static_context_consts.h'
--- src/context/static_context_consts.h	2011-07-21 23:02:27 +0000
+++ src/context/static_context_consts.h	2011-12-05 15:36:30 +0000
@@ -120,40 +120,6 @@
     decl_manual
   };
 
-  enum annotations_t
-  {
-    fn_public = 0,
-    fn_private,
-    zann_deterministic,
-    zann_nondeterministic,
-    zann_assignable,
-    zann_nonassignable,
-    zann_sequential,
-    zann_nonsequential,
-    zann_variadic,
-    zann_streamable,
-    zann_unique,
-    zann_nonunique,
-    zann_value_equality,
-    zann_general_equality,
-    zann_value_range,
-    zann_general_range,
-    zann_automatic,
-    zann_manual,
-    zann_mutable,
-    zann_queue,
-    zann_append_only,
-    zann_const,
-    zann_ordered,
-    zann_unordered,
-    zann_read_only_nodes,
-    zann_mutable_nodes,
-
-    // must be at the end
-    zann_end
-
-  };
-  
   enum node_modifier_t
   {
     read_only,

=== modified file 'src/runtime/core/gflwor/common.cpp'
--- src/runtime/core/gflwor/common.cpp	2011-10-22 15:44:45 +0000
+++ src/runtime/core/gflwor/common.cpp	2011-12-05 15:36:30 +0000
@@ -187,14 +187,15 @@
 {
   uint32_t hash = 0;
 
-  csize numCols = theGroupingSpecs->size();
+  std::vector<store::Item_t>::const_iterator ite = t->theTypedValues.begin();
+  std::vector<store::Item_t>::const_iterator end = t->theTypedValues.end();
+  std::vector<GroupingSpec>::const_iterator ite2 = theGroupingSpecs->begin();
 
-  for (csize i = 0; i < numCols; i++)
+  for (; ite != end; ++ite, ++ite2)
   {
-    if (t->theTypedValues[i] != NULL)
+    if (*ite)
     {
-      hash += t->theTypedValues[i]->hash(theTimezone,
-                                         (*theGroupingSpecs)[i].theCollator);
+      hash += (*ite)->hash(theTimezone, (*ite2).theCollator);
     }
   }
 
@@ -207,46 +208,49 @@
   assert(theGroupingSpecs->size() == t1->theTypedValues.size());
   assert(t2->theTypedValues.size() == t1->theTypedValues.size());
 
+  std::vector<store::Item_t>::const_iterator end1 = t1->theTypedValues.end();
   std::vector<store::Item_t>::const_iterator iter1 = t1->theTypedValues.begin();
   std::vector<store::Item_t>::const_iterator iter2 = t2->theTypedValues.begin();
-  std::vector<store::Item_t>::const_iterator end = t1->theTypedValues.end();
-  long i = 0;
+  std::vector<GroupingSpec>::const_iterator iter3 = theGroupingSpecs->begin();
 
-  while(iter1 != end)
+  while (iter1 != end1)
   {
-    if(*iter1 == NULL)
+    const store::Item* item1 = (*iter1).getp();
+    const store::Item* item2 = (*iter2).getp();
+
+    if (item1 == NULL)
     {      
-      if(*iter2 != NULL)
+      if (item2 != NULL)
       {
         return false;
       }
     }
-    else if(*iter2 == NULL)
+    else if (item2 == NULL)
     {
       return false;
     }
     else
     {
-      store::Item_t item1 = *iter1;
-      store::Item_t item2 = *iter2;
-
       try
       {
-        if ((*theGroupingSpecs)[i].theDoFastComparison)
+        if ((*iter3).theDoFastComparison)
         {
-          if (!item1->equals(item2, theTimezone, (*theGroupingSpecs)[i].theCollator))
+          if (!item1->equals(item2, theTimezone, (*iter3).theCollator))
           {
             return false;
           }
         }
         else
         {
+          store::Item_t tmp1 = (*iter1);
+          store::Item_t tmp2 = (*iter2);
+
           if (!CompareIterator::valueEqual(theLocation,
-                                           item1,
-                                           item2,
+                                           tmp1,
+                                           tmp2,
                                            theTypeManager,
                                            theTimezone,
-                                           (*theGroupingSpecs)[i].theCollator))
+                                           (*iter3).theCollator))
           {
             return false;                                 
           }
@@ -262,7 +266,7 @@
       }
     }
     
-    ++i;
+    ++iter3;
     ++iter1;
     ++iter2;
   }

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to