-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wand optimize cursor class #968
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zhengbuqian The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@zhengbuqian 🔍 Important: PR Classification Needed! For efficient project management and a seamless review process, it's essential to classify your PR correctly. Here's how:
For any PR outside the kind/improvement category, ensure you link to the associated issue using the format: “issue: #”. Thanks for your efforts and contribution to the community!. |
/kind improvement |
simplify code to drop Signed-off-by: Buqian Zheng <[email protected]>
755ec15
to
128cdb5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #968 +/- ##
=========================================
+ Coverage 0 74.37% +74.37%
=========================================
Files 0 82 +82
Lines 0 6685 +6685
=========================================
+ Hits 0 4972 +4972
- Misses 0 1713 +1713 |
inline void | ||
update_cur_vec_id() { | ||
if (loc_ >= lut_size_) { | ||
cur_vec_id_ = total_num_vec_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just double-checking that this is not total_num_vec_ - 1
. According to standard naming conventions, id_
is assumed to be something within [0, num)
range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is not total_num_vec_ - 1
. When id_
is in [0, num)
range it is still in range and the cursor is pointing at some doc, loc_ >= lut_size_
means it is out of range and the cursor points at no doc.
/lgtm |
issue: #967 |
…liztech#968) simplify code to drop Signed-off-by: Buqian Zheng <[email protected]> Signed-off-by: xianliang.li <[email protected]>
* wand: optimize cursor class to get ~10% performance improvement; (#968) simplify code to drop Signed-off-by: Buqian Zheng <[email protected]> Signed-off-by: xianliang.li <[email protected]> * update cardinal version Signed-off-by: xianliang.li <[email protected]> --------- Signed-off-by: Buqian Zheng <[email protected]> Signed-off-by: xianliang.li <[email protected]> Co-authored-by: Buqian Zheng <[email protected]>
the main change is to update the cursor class to cache certain info, as per the perf result those size() calls used quite a lot of extra CPU cycles
also simplifed code to drop less important elements
simple benchmark result(time used to search all queries once on the full dataset) with drop ratio build 0.32 and drop ratio search 0.6: