You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by GitBox <gi...@apache.org> on 2020/02/18 20:37:11 UTC

[GitHub] [incubator-datasketches-cpp] jmalkin commented on a change in pull request #85: HLL union performance improvement

jmalkin commented on a change in pull request #85: HLL union performance improvement
URL: https://github.com/apache/incubator-datasketches-cpp/pull/85#discussion_r380427437
 
 

 ##########
 File path: hll/include/HllSketchImplFactory.hpp
 ##########
 @@ -146,76 +139,18 @@ Hll4Array<A>* HllSketchImplFactory<A>::convertToHll4(const HllArray<A>& srcHllAr
   typedef typename std::allocator_traits<A>::template rebind_alloc<Hll4Array<A>> hll4Alloc;
   Hll4Array<A>* hll4Array = new (hll4Alloc().allocate(1)) Hll4Array<A>(lgConfigK, srcHllArr.isStartFullSize());
   hll4Array->putOutOfOrderFlag(srcHllArr.isOutOfOrderFlag());
-
-  // 1st pass: compute starting curMin and numAtCurMin
-  int pairVals = curMinAndNum(srcHllArr);
-  int curMin = HllUtil<A>::getValue(pairVals);
-  int numAtCurMin = HllUtil<A>::getLow26(pairVals);
-
-  // 2nd pass: must know curMin.
-  // Populate KxQ registers, build AuxHashMap if needed
-  pair_iterator_with_deleter<A> itr = srcHllArr.getIterator();
-  // nothing allocated, may be null
-  AuxHashMap<A>* auxHashMap = srcHllArr.getAuxHashMap();
-
-  while (itr->nextValid()) {
-    const int slotNo = itr->getIndex();
-    const int actualValue = itr->getValue();
-    HllArray<A>::hipAndKxQIncrementalUpdate(*hll4Array, 0, actualValue);
-    if (actualValue >= (curMin + 15)) {
-      hll4Array->putSlot(slotNo, HllUtil<A>::AUX_TOKEN);
-      if (auxHashMap == nullptr) {
-        auxHashMap = AuxHashMap<A>::newAuxHashMap(HllUtil<A>::LG_AUX_ARR_INTS[lgConfigK], lgConfigK);
-        hll4Array->putAuxHashMap(auxHashMap);
-      }
-      auxHashMap->mustAdd(slotNo, actualValue);
-    } else {
-      hll4Array->putSlot(slotNo, actualValue - curMin);
-    }
-  }
-
-  hll4Array->putCurMin(curMin);
-  hll4Array->putNumAtCurMin(numAtCurMin);
+  hll4Array->mergeHll(srcHllArr);
 
 Review comment:
   .. yeah, that was a much simpler approach overall.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org