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

alsay pushed a commit to branch quotient-filter
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git


The following commit(s) were added to refs/heads/quotient-filter by this push:
     new 87abf9cf no need to find the first empty slot
87abf9cf is described below

commit 87abf9cf55022c0c4d59e5e1b8984c9546170573
Author: AlexanderSaydakov <[email protected]>
AuthorDate: Tue May 28 14:19:25 2024 -0700

    no need to find the first empty slot
---
 .../datasketches/filters/quotientfilter/QuotientFilter.java   | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git 
a/src/main/java/org/apache/datasketches/filters/quotientfilter/QuotientFilter.java
 
b/src/main/java/org/apache/datasketches/filters/quotientfilter/QuotientFilter.java
index 93a6761c..35c6f005 100644
--- 
a/src/main/java/org/apache/datasketches/filters/quotientfilter/QuotientFilter.java
+++ 
b/src/main/java/org/apache/datasketches/filters/quotientfilter/QuotientFilter.java
@@ -379,14 +379,6 @@ public class QuotientFilter extends Filter {
         return existing;
     }
 
-    // finds the first empty slot after the given slot index
-    long find_first_empty_slot(long index) {
-        while (!is_slot_empty(index)) {
-            index = (index + 1) & getMask();
-        }
-        return index;
-    }
-
     // return the first slot to the right where the current run starting at 
the index parameter ends
     long find_new_run_location(long index) {
         if (!is_slot_empty(index)) {
@@ -399,14 +391,13 @@ public class QuotientFilter extends Filter {
     }
 
     boolean insert_new_run(long canonical_slot, long long_fp) {
-        long first_empty_slot = find_first_empty_slot(canonical_slot); // 
finds the first empty slot to the right of the canonical slot that is empty
         long preexisting_run_start_index = find_run_start(canonical_slot); // 
scans the cluster leftwards and then to the right until reaching our run's 
would be location
         long start_of_this_new_run = 
find_new_run_location(preexisting_run_start_index); // If there is already a 
run at the would-be location, find its end and insert the new run after it
         boolean slot_initially_empty = is_slot_empty(start_of_this_new_run);
 
         // modify some metadata flags to mark the new run
         set_occupied(canonical_slot, true);
-        if (first_empty_slot != canonical_slot) {
+        if (start_of_this_new_run != canonical_slot) {
             set_shifted(start_of_this_new_run, true);
         }
         set_continuation(start_of_this_new_run, false);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to