This is an automated email from the ASF dual-hosted git repository.

alsay pushed a commit to branch hll_merge_speed
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git

commit ba38c75005e36d736f88f732705a55da846fce2c
Author: AlexanderSaydakov <[email protected]>
AuthorDate: Tue Mar 7 15:01:19 2023 -0800

    minor cleanup and slight performance improvement
---
 hll/include/Hll4Array-internal.hpp |  2 +-
 hll/include/Hll8Array-internal.hpp |  8 +++-----
 hll/include/HllArray-internal.hpp  | 14 ++------------
 hll/include/HllArray.hpp           |  4 ----
 4 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/hll/include/Hll4Array-internal.hpp 
b/hll/include/Hll4Array-internal.hpp
index e8ace21..8e385ec 100644
--- a/hll/include/Hll4Array-internal.hpp
+++ b/hll/include/Hll4Array-internal.hpp
@@ -210,7 +210,7 @@ void Hll4Array<A>::internalHll4Update(uint32_t slotNo, 
uint8_t newVal) {
 
       // we just increased a pair value, so it might be time to change curMin
       if (actualOldValue == this->curMin_) { // 908
-        this->decNumAtCurMin();
+        --(this->numAtCurMin_);
         while (this->numAtCurMin_ == 0) {
           shiftToBiggerCurMin(); // increases curMin by 1, builds a new aux 
table
           // shifts values in 4-bit table and recounts curMin
diff --git a/hll/include/Hll8Array-internal.hpp 
b/hll/include/Hll8Array-internal.hpp
index 69d7ca8..b797359 100644
--- a/hll/include/Hll8Array-internal.hpp
+++ b/hll/include/Hll8Array-internal.hpp
@@ -77,13 +77,11 @@ void Hll8Array<A>::internalCouponUpdate(uint32_t coupon) {
   const uint32_t slotNo = HllUtil<A>::getLow26(coupon) & configKmask;
   const uint8_t newVal = HllUtil<A>::getValue(coupon);
 
-  const uint8_t curVal = getSlot(slotNo);
+  const uint8_t curVal = this->hllByteArr_[slotNo];
   if (newVal > curVal) {
-    putSlot(slotNo, newVal);
+    this->hllByteArr_[slotNo] = newVal;
     this->hipAndKxQIncrementalUpdate(curVal, newVal);
-    if (curVal == 0) {
-      this->numAtCurMin_--; // interpret numAtCurMin as num zeros
-    }
+    this->numAtCurMin_ -= curVal == 0; // interpret numAtCurMin as num zeros
   }
 }
 
diff --git a/hll/include/HllArray-internal.hpp 
b/hll/include/HllArray-internal.hpp
index 1652912..e4d25ac 100644
--- a/hll/include/HllArray-internal.hpp
+++ b/hll/include/HllArray-internal.hpp
@@ -299,7 +299,7 @@ double HllArray<A>::getEstimate() const {
   if (oooFlag_) {
     return getCompositeEstimate();
   }
-  return getHipAccum();
+  return hipAccum_;
 }
 
 // HLL UPPER AND LOWER BOUNDS
@@ -434,16 +434,6 @@ void HllArray<A>::putNumAtCurMin(uint32_t numAtCurMin) {
   numAtCurMin_ = numAtCurMin;
 }
 
-template<typename A>
-void HllArray<A>::decNumAtCurMin() {
-  --numAtCurMin_;
-}
-
-template<typename A>
-void HllArray<A>::addToHipAccum(double delta) {
-  hipAccum_ += delta;
-}
-
 template<typename A>
 bool HllArray<A>::isCompact() const {
   return false;
@@ -452,7 +442,7 @@ bool HllArray<A>::isCompact() const {
 template<typename A>
 bool HllArray<A>::isEmpty() const {
   const uint32_t configK = 1 << this->lgConfigK_;
-  return (getCurMin() == 0) && (getNumAtCurMin() == configK);
+  return (curMin_ == 0) && (numAtCurMin_ == configK);
 }
 
 template<typename A>
diff --git a/hll/include/HllArray.hpp b/hll/include/HllArray.hpp
index 28c5cbb..f3acea7 100644
--- a/hll/include/HllArray.hpp
+++ b/hll/include/HllArray.hpp
@@ -52,10 +52,6 @@ class HllArray : public HllSketchImpl<A> {
     virtual double getLowerBound(uint8_t numStdDev) const;
     virtual double getUpperBound(uint8_t numStdDev) const;
 
-    inline void addToHipAccum(double delta);
-
-    inline void decNumAtCurMin();
-
     inline uint8_t getCurMin() const;
     inline uint32_t getNumAtCurMin() const;
     inline double getHipAccum() const;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to