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

perf: use a binary search for kallsyms lookup #104

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

xh4n3
Copy link
Contributor

@xh4n3 xh4n3 commented Sep 5, 2023

The /proc/kallsyms can be more than 100k lines, a sequential search can be slow.
Since the getAllSyms() already sorted the kallsyms array, we can do a binary search for kallsyms lookup.

I did a performance compare locally between the two methods, result:

=== RUN   TestGetSymPtFromBpfLocationPerformance
    kallsyms_test.go:56: old_method cost: 11.123334464s
        new_method cost: 66.415172ms
--- PASS: TestGetSymPtFromBpfLocationPerformance (11.19s)

@CLAassistant
Copy link

CLAassistant commented Sep 5, 2023

CLA assistant check
All committers have signed the CLA.

Signed-off-by: xh4n3 <xyn1016@gmail.com>
@Lyt99 Lyt99 merged commit 67be2b8 into alibaba:main Sep 5, 2023
7 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.

4 participants