You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by hb...@apache.org on 2016/10/05 21:08:24 UTC

incubator-quickstep git commit: Remove unnecessary code from resize()

Repository: incubator-quickstep
Updated Branches:
  refs/heads/fix-fasthash-resize [created] 3e8f6c9a3


Remove unnecessary code from resize()

- In resize, all the values are moved from original hash table are
  copied to the new hash table using memcpy().
- Removed the for loop where values are constructed using 'new' operator, as
  all the values are trivially constructible in the specialized
  aggregation hash table implementation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/3e8f6c9a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/3e8f6c9a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/3e8f6c9a

Branch: refs/heads/fix-fasthash-resize
Commit: 3e8f6c9a36ea3e0e5526d7baaf4279c34fdfcd85
Parents: 4126c4f
Author: Harshad Deshmukh <hb...@apache.org>
Authored: Wed Oct 5 16:05:05 2016 -0500
Committer: Harshad Deshmukh <hb...@apache.org>
Committed: Wed Oct 5 16:05:05 2016 -0500

----------------------------------------------------------------------
 storage/FastSeparateChainingHashTable.hpp | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3e8f6c9a/storage/FastSeparateChainingHashTable.hpp
----------------------------------------------------------------------
diff --git a/storage/FastSeparateChainingHashTable.hpp b/storage/FastSeparateChainingHashTable.hpp
index 886a8ca..a41535c 100644
--- a/storage/FastSeparateChainingHashTable.hpp
+++ b/storage/FastSeparateChainingHashTable.hpp
@@ -1450,27 +1450,11 @@ void FastSeparateChainingHashTable<
   //       d. Relative pointers are not used with resizable hash tables.
   //     4. If values are not trivially copyable, then we invoke ValueT's copy
   //        or move constructor with placement new.
+  // NOTE(harshad) - Regarding point 4 above, as this is a specialized
+  // hash table implemented for aggregation, the values are trivially copyable,
+  // therefore we don't need to invoke payload values' copy/move constructors.
   std::memcpy(resized_buckets, buckets_, original_buckets_used * bucket_size_);
 
-  // TODO(chasseur): std::is_trivially_copyable is not yet implemented in
-  // GCC 4.8.3, so we assume we need to invoke ValueT's copy or move
-  // constructor, even though the plain memcpy above could suffice for many
-  // possible ValueTs.
-  void *current_value_original = static_cast<char *>(buckets_) + kValueOffset;
-  void *current_value_resized =
-      static_cast<char *>(resized_buckets) + kValueOffset;
-  for (std::size_t bucket_num = 0; bucket_num < original_buckets_used;
-       ++bucket_num) {
-    // Use a move constructor if available to avoid a deep-copy, since resizes
-    // always succeed.
-    new (current_value_resized) std::uint8_t(
-        std::move(*static_cast<std::uint8_t *>(current_value_original)));
-    current_value_original =
-        static_cast<char *>(current_value_original) + bucket_size_;
-    current_value_resized =
-        static_cast<char *>(current_value_resized) + bucket_size_;
-  }
-
   // Copy over variable-length key components, if any.
   if (original_variable_storage_used > 0) {
     DEBUG_ASSERT(original_variable_storage_used ==