Skip to content
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

use binary search to optimize performance #820

Merged
merged 1 commit into from Apr 7, 2023

Conversation

Lan-ce-lot
Copy link
Contributor

Use binary search to optimize performance in pkg/ksyms/ksyms.go

@Lan-ce-lot Lan-ce-lot requested a review from a team as a code owner March 17, 2023 14:00
@Lan-ce-lot Lan-ce-lot force-pushed the binary-search branch 2 times, most recently from 60f1bbd to 311b498 Compare March 17, 2023 14:04
Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Since binary search can be tricky to implement in some cases (e.g., https://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html), can we please add some unit tests for this?

@Lan-ce-lot
Copy link
Contributor Author

Lan-ce-lot commented Mar 28, 2023

Ok, I will add tests.

@Lan-ce-lot
Copy link
Contributor Author

I added some tests, the previous code and the current code have passed. And I prevents overflow at the same time.

m := l + ((r - l + 1) >> 1)

PTAL, thanks! @kkourt

@Lan-ce-lot Lan-ce-lot requested review from kkourt and removed request for jrfastab March 29, 2023 09:01
Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I believe that the correct behavior if a user requests the address of a symbol is to return this symbol with an offset of zero.

Could you also add a Signed-off-by with a real name? See: https://docs.cilium.io/en/v1.13/contributing/development/contributing_guide/#dev-coo

pkg/ksyms/ksyms_test.go Show resolved Hide resolved
@netlify
Copy link

netlify bot commented Apr 3, 2023

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit ce76223
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/642a7ca8e594440008b8087f
😎 Deploy Preview https://deploy-preview-820--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Signed-off-by: Changsheng Huang <1984737645@qq.com>
@Lan-ce-lot
Copy link
Contributor Author

Thanks!

I believe that the correct behavior if a user requests the address of a symbol is to return this symbol with an offset of zero.

Could you also add a Signed-off-by with a real name? See: https://docs.cilium.io/en/v1.13/contributing/development/contributing_guide/#dev-coo

Sure!

@Lan-ce-lot
Copy link
Contributor Author

I added a Signed-off-by with a real name.
PTAL, Thanks! @kkourt

Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jrfastab jrfastab merged commit 3db9b2a into cilium:main Apr 7, 2023
17 checks passed
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.

None yet

3 participants