You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2017/10/21 06:39:54 UTC

kylin git commit: KYLIN-2944 Verify performance impact

Repository: kylin
Updated Branches:
  refs/heads/master 2b32aa4ca -> d0ff77444


KYLIN-2944 Verify performance impact


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/d0ff7744
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/d0ff7744
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/d0ff7744

Branch: refs/heads/master
Commit: d0ff774448fd4dc72d258ac79192a5419d96d65e
Parents: 2b32aa4
Author: Li Yang <li...@apache.org>
Authored: Sat Oct 21 14:39:48 2017 +0800
Committer: Li Yang <li...@apache.org>
Committed: Sat Oct 21 14:39:48 2017 +0800

----------------------------------------------------------------------
 .../kylin/measure/hllc/HLLCSerializer.java      |  6 ++--
 .../hllc/NewHyperLogLogBenchmarkTest.java       | 34 +++++++++++++++++++-
 2 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/d0ff7744/core-metadata/src/main/java/org/apache/kylin/measure/hllc/HLLCSerializer.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/measure/hllc/HLLCSerializer.java b/core-metadata/src/main/java/org/apache/kylin/measure/hllc/HLLCSerializer.java
index ddf8281..98bc5cf 100644
--- a/core-metadata/src/main/java/org/apache/kylin/measure/hllc/HLLCSerializer.java
+++ b/core-metadata/src/main/java/org/apache/kylin/measure/hllc/HLLCSerializer.java
@@ -18,12 +18,12 @@
 
 package org.apache.kylin.measure.hllc;
 
-import org.apache.kylin.metadata.datatype.DataType;
-import org.apache.kylin.metadata.datatype.DataTypeSerializer;
-
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
+import org.apache.kylin.metadata.datatype.DataType;
+import org.apache.kylin.metadata.datatype.DataTypeSerializer;
+
 /**
  * @author yangli9
  * 

http://git-wip-us.apache.org/repos/asf/kylin/blob/d0ff7744/core-metadata/src/test/java/org/apache/kylin/measure/hllc/NewHyperLogLogBenchmarkTest.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/test/java/org/apache/kylin/measure/hllc/NewHyperLogLogBenchmarkTest.java b/core-metadata/src/test/java/org/apache/kylin/measure/hllc/NewHyperLogLogBenchmarkTest.java
index ee82f9b..895c9a9 100644
--- a/core-metadata/src/test/java/org/apache/kylin/measure/hllc/NewHyperLogLogBenchmarkTest.java
+++ b/core-metadata/src/test/java/org/apache/kylin/measure/hllc/NewHyperLogLogBenchmarkTest.java
@@ -22,11 +22,11 @@ import static org.junit.Assert.assertEquals;
 import java.nio.ByteBuffer;
 import java.util.Random;
 
+import org.apache.kylin.metadata.datatype.DataType;
 import org.junit.Ignore;
 import org.junit.Test;
 
 /**
- * Created by xiefan on 16-12-12.
  */
 @Ignore("Save UT time")
 @SuppressWarnings("deprecation")
@@ -265,6 +265,38 @@ public class NewHyperLogLogBenchmarkTest {
         HLLCounter.OVERFLOW_FACTOR = oldFactor;
     }
 
+    // Test the performance impact of KYLIN-2944.
+    // The result shows returning a shared object or not DON'T impact performance.
+    @Test
+    public void generalDeserializeBenchmark() throws Exception {
+        final HLLCSerializer ser = new HLLCSerializer(DataType.getType("hllc(15)"));
+        final ByteBuffer buf = ByteBuffer.allocate(1024 * 1024);
+        
+        for (int r = 0; r < 5; r++) {
+            final int p = 15;
+            final int m = 1 << p;
+            System.out.println("generalDeserializeBenchmark()");
+            System.out.println("----------------------------");
+
+            for (int cardinality : getTestDataDivide(m)) {
+                final HLLCounter newCounter = getRandNewCounter(p, cardinality);
+                buf.clear();
+                ser.serialize(newCounter, buf);
+
+                long time = runTestCase(new TestCase() {
+                    @Override
+                    public void run() throws Exception {
+                        for (int i = 0; i < testTimes; i++) {
+                            buf.flip();
+                            ser.deserialize(buf);
+                        }
+                    }
+                });
+                System.out.println("cardinality : " + cardinality + ", deserialize time : " + time);
+            }
+        }
+    }
+
     interface TestCase {
         void run() throws Exception;
     }