You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2020/01/06 23:58:37 UTC

[incubator-datasketches-characterization] 02/03: Updating HllUnionUpdateSpeed profile and config.

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

leerho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-characterization.git

commit 3e7e7aa20f69449ca51abd31d5b7597f91ce4e2d
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Jan 6 15:57:40 2020 -0800

    Updating HllUnionUpdateSpeed profile and config.
---
 .../characterization/hll/HllUnionUpdateSpeedProfile.java | 16 ++++++++++++++--
 src/main/resources/hll/HllUnionUpdateSpeedJob.conf       |  1 +
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/characterization/hll/HllUnionUpdateSpeedProfile.java b/src/main/java/org/apache/datasketches/characterization/hll/HllUnionUpdateSpeedProfile.java
index e17a5de..238e17a 100644
--- a/src/main/java/org/apache/datasketches/characterization/hll/HllUnionUpdateSpeedProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/hll/HllUnionUpdateSpeedProfile.java
@@ -23,25 +23,37 @@ import org.apache.datasketches.characterization.uniquecount.BaseUpdateSpeedProfi
 import org.apache.datasketches.hll.HllSketch;
 import org.apache.datasketches.hll.TgtHllType;
 import org.apache.datasketches.hll.Union;
+import org.apache.datasketches.memory.WritableMemory;
 
 public class HllUnionUpdateSpeedProfile extends BaseUpdateSpeedProfile {
   private int lgK;
   private TgtHllType tgtHllType;
   private int numSketches;
   private HllSketch[] sketches;
+  private boolean direct;
 
   @Override
   public void configure() {
     lgK = Integer.parseInt(prop.mustGet("LgK"));
     tgtHllType = TgtHllType.valueOf(prop.mustGet("TgtHllType"));
+
     numSketches = Integer.parseInt(prop.mustGet("NumSketches"));
     sketches = new HllSketch[numSketches];
+    direct = Boolean.parseBoolean(prop.mustGet("Direct"));
   }
 
   @Override
   public double doTrial(final int uPerTrial) {
-    for (int i = 0; i < numSketches; i++) {
-      sketches[i] = new HllSketch(lgK, tgtHllType);
+    if (direct) {
+      final int bytes = HllSketch.getMaxUpdatableSerializationBytes(lgK, tgtHllType);
+      for (int i = 0; i < numSketches; i++) {
+        final WritableMemory wmem = WritableMemory.allocate(bytes);
+        sketches[i] = new HllSketch(lgK, tgtHllType, wmem);
+      }
+    } else {
+      for (int i = 0; i < numSketches; i++) {
+        sketches[i] = new HllSketch(lgK, tgtHllType);
+      }
     }
 
     { // spray values across all sketches
diff --git a/src/main/resources/hll/HllUnionUpdateSpeedJob.conf b/src/main/resources/hll/HllUnionUpdateSpeedJob.conf
index 714a3ed..b203583 100644
--- a/src/main/resources/hll/HllUnionUpdateSpeedJob.conf
+++ b/src/main/resources/hll/HllUnionUpdateSpeedJob.conf
@@ -41,3 +41,4 @@ JobProfile=org.apache.datasketches.characterization.hll.HllUnionUpdateSpeedProfi
 LgK=12
 NumSketches=32
 TgtHllType=HLL_8
+Direct=true


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