Skip to content

Perf/bounded comparator #1460

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ggq89
Copy link
Contributor

@ggq89 ggq89 commented Mar 29, 2025

Description

This PR mainly annotates IsLess and IsLessEq of BoundedComparator and adds test cases to prevent misuse.

Type of change

  • This change requires a documentation update

How has this been tested?

  • TestBoundedComparator

How has this been benchmarked?

  • Benchmark A, on Macbook pro M1, 32GB RAM
  • Benchmark B, on x86 Intel xxx, 16GB RAM

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ggq89
Copy link
Contributor Author

ggq89 commented Mar 29, 2025

In general, it is recommended that BoundedComparator do not provide the IsLess and IsLessEq methods to the outside world. First, they are easy to misuse, and second, there are alternative methods in generic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant