asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (Code Review)" <do-not-re...@asterix-gerrit.ics.uci.edu>
Subject Change in hyracks[master]: This change includes: 1. avoid calling ByteBuffer.get() and ...
Date Tue, 11 Aug 2015 06:57:22 GMT
Yingyi Bu has submitted this change and it was merged.

Change subject: This change includes: 1. avoid calling ByteBuffer.get() and ByteBuffer.put()
for bloom filter set/get operations. ByteBuffer will check boundaries of the index for get/put.
It's a very frequent operation. 2. let the hash table size in BufferCache be 3X of
......................................................................


This change includes:
1. avoid calling ByteBuffer.get() and ByteBuffer.put() for bloom filter set/get operations.
ByteBuffer will check boundaries of the index for get/put.
It's a very frequent operation.
2. let the hash table size in BufferCache be 3X of the buffer cache page count.  This will
even reduce conflicts.

Change-Id: Ifd47c410338ce557a494ab3605660bad1899e786
Reviewed-on: https://asterix-gerrit.ics.uci.edu/345
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Young-Seok Kim <kisskys@gmail.com>
Reviewed-by: Ian Maxon <imaxon@apache.org>
---
M hyracks/hyracks-storage-am-bloomfilter/src/main/java/edu/uci/ics/hyracks/storage/am/bloomfilter/impls/BloomFilter.java
M hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
2 files changed, 7 insertions(+), 9 deletions(-)

Approvals:
  Young-Seok Kim: Looks good to me, but someone else must approve
  Ian Maxon: Looks good to me, approved
  Jenkins: Verified



diff --git a/hyracks/hyracks-storage-am-bloomfilter/src/main/java/edu/uci/ics/hyracks/storage/am/bloomfilter/impls/BloomFilter.java
b/hyracks/hyracks-storage-am-bloomfilter/src/main/java/edu/uci/ics/hyracks/storage/am/bloomfilter/impls/BloomFilter.java
index 957659b..768841a 100644
--- a/hyracks/hyracks-storage-am-bloomfilter/src/main/java/edu/uci/ics/hyracks/storage/am/bloomfilter/impls/BloomFilter.java
+++ b/hyracks/hyracks-storage-am-bloomfilter/src/main/java/edu/uci/ics/hyracks/storage/am/bloomfilter/impls/BloomFilter.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -87,7 +87,7 @@
         }
         MurmurHash128Bit.hash3_x64_128(tuple, keyFields, SEED, hashes);
         for (int i = 0; i < numHashes; ++i) {
-            long hash = Math.abs((hashes[0] + (long) i * hashes[1]) % numBits);
+            long hash = Math.abs((hashes[0] + i * hashes[1]) % numBits);
 
             // we increment the page id by one, since the metadata page id of the filter
is 0.
             ICachedPage page = bufferCache.pin(
@@ -272,7 +272,7 @@
             }
             MurmurHash128Bit.hash3_x64_128(tuple, keyFields, SEED, hashes);
             for (int i = 0; i < numHashes; ++i) {
-                long hash = Math.abs((hashes[0] + (long) i * hashes[1]) % numBits);
+                long hash = Math.abs((hashes[0] + i * hashes[1]) % numBits);
 
                 // we increment the page id by one, since the metadata page id of the filter
is 0.
                 ICachedPage page = bufferCache.pin(
@@ -281,16 +281,14 @@
                 try {
                     ByteBuffer buffer = page.getBuffer();
                     int byteIndex = (int) (hash % numBitsPerPage) >> 3; // divide by
8
-                    byte b = buffer.get(byteIndex);
+                    byte b = buffer.array()[byteIndex];
                     int bitIndex = (int) (hash % numBitsPerPage) & 0x07; // mod 8
                     b = (byte) (b | (1 << bitIndex));
-
-                    buffer.put(byteIndex, b);
+                    buffer.array()[byteIndex] = b;
                 } finally {
                     page.releaseWriteLatch(true);
                     bufferCache.unpin(page);
                 }
-
             }
         }
 
diff --git a/hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
b/hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
index d973947..2228f8c 100644
--- a/hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
@@ -41,7 +41,7 @@
 
 public class BufferCache implements IBufferCacheInternal, ILifeCycleComponent {
     private static final Logger LOGGER = Logger.getLogger(BufferCache.class.getName());
-    private static final int MAP_FACTOR = 2;
+    private static final int MAP_FACTOR = 3;
 
     private static final int MIN_CLEANED_COUNT_DIFF = 3;
     private static final int PIN_MAX_WAIT_TIME = 50;

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/345
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd47c410338ce557a494ab3605660bad1899e786
Gerrit-PatchSet: 2
Gerrit-Project: hyracks
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: Ian Maxon <imaxon@apache.org>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: Young-Seok Kim <kisskys@gmail.com>

Mime
View raw message