You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by ti...@apache.org on 2026/07/25 13:45:38 UTC
(datasketches-rust) 08/13: refactor(theta): clarify hash table capacity threshold
This is an automated email from the ASF dual-hosted git repository.
tisonkun pushed a commit to branch codex/naming-drift-audit
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git
commit 2a01ef3cdada9656bc0c04cd7dcb4b36a25ac4df
Author: tison <wa...@gmail.com>
AuthorDate: Sat Jul 25 21:42:47 2026 +0800
refactor(theta): clarify hash table capacity threshold
---
datasketches/src/theta/hash_table.rs | 2 +-
datasketches/src/thetacommon/hash_table.rs | 8 ++++----
datasketches/src/tuple/hash_table.rs | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/datasketches/src/theta/hash_table.rs b/datasketches/src/theta/hash_table.rs
index 8bd2aa9..0837147 100644
--- a/datasketches/src/theta/hash_table.rs
+++ b/datasketches/src/theta/hash_table.rs
@@ -382,7 +382,7 @@ mod tests {
}
}
- let rebuild_threshold = table.get_capacity();
+ let rebuild_threshold = table.capacity_threshold();
loop {
let hash = table.hash(i);
diff --git a/datasketches/src/thetacommon/hash_table.rs b/datasketches/src/thetacommon/hash_table.rs
index c9f2e45..7e0f7fc 100644
--- a/datasketches/src/thetacommon/hash_table.rs
+++ b/datasketches/src/thetacommon/hash_table.rs
@@ -182,8 +182,8 @@ where
self.num_retained += 1;
// Check if we need to resize or rebuild.
- let capacity = self.get_capacity();
- if self.num_retained > capacity {
+ let capacity_threshold = self.capacity_threshold();
+ if self.num_retained > capacity_threshold {
if self.lg_cur_size <= self.lg_nom_size {
self.resize();
} else {
@@ -205,8 +205,8 @@ where
}
}
- /// Get capacity threshold.
- pub fn get_capacity(&self) -> usize {
+ /// Return the current resize or rebuild capacity threshold.
+ pub fn capacity_threshold(&self) -> usize {
let fraction = if self.lg_cur_size <= self.lg_nom_size {
HASH_TABLE_RESIZE_THRESHOLD
} else {
diff --git a/datasketches/src/tuple/hash_table.rs b/datasketches/src/tuple/hash_table.rs
index 138c940..de0ff1f 100644
--- a/datasketches/src/tuple/hash_table.rs
+++ b/datasketches/src/tuple/hash_table.rs
@@ -444,7 +444,7 @@ mod tests {
}
}
- let rebuild_threshold = table.get_capacity();
+ let rebuild_threshold = table.capacity_threshold();
loop {
let hash = table.hash(i);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org