You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "songgaoye (via GitHub)" <gi...@apache.org> on 2026/10/19 15:01:21 UTC

[PR] perf(zset): avoid sorting inputs for ZINTERCARD [kvrocks]

songgaoye opened a new pull request, #3697:
URL: https://github.com/apache/kvrocks/pull/3697

   Summary
   
   Avoid sorting and copying all input member lists when calculating `ZINTERCARD`.
   
   - Use `std::min_element` to select the smallest input set as the intersection base.
   - Iterate over all remaining sets while skipping the selected base iterator.
   - Replace the per-member map counter with a local counter.
   
   The previous implementation sorted every input list only to select the smallest one, copied that list, and allocated map entries for each candidate member.
   
   ## Tests
   
   - Added `ZINTERCARD` coverage where the smallest input is not the first key.
   - Added `LIMIT` coverage for the same input order.
   - `gofmt -w tests/gocase/unit/type/zset/zset_test.go`
   - LLVM 18 `clang-tidy` on `src/types/redis_zset.cc`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(zset): avoid sorting inputs for ZINTERCARD [kvrocks]

Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk merged PR #3697:
URL: https://github.com/apache/kvrocks/pull/3697


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org