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

btf: use iterators #1682

Merged
merged 1 commit into from
Feb 14, 2025
Merged

btf: use iterators #1682

merged 1 commit into from
Feb 14, 2025

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Feb 13, 2025

Now that we're on 1.23 we can use iterators. The existing iterators don't really need to be modified. Allocations don't change, run time seems a little bit faster.

core: 1
goos: linux
goarch: amd64
pkg: github.com/cilium/ebpf/btf
cpu: 13th Gen Intel(R) Core(TM) i7-1365U
                                    │   base.txt   │              iter.txt              │
                                    │    sec/op    │    sec/op     vs base              │
PostorderTraversal/single_type           49.79n ± ∞ ¹   48.68n ± ∞ ¹  -2.23% (p=0.029 n=4)
PostorderTraversal/cycle(1)              146.4n ± ∞ ¹   135.8n ± ∞ ¹  -7.24% (p=0.029 n=4)
PostorderTraversal/cycle(10)             1.928µ ± ∞ ¹   1.861µ ± ∞ ¹  -3.45% (p=0.029 n=4)
PostorderTraversal/gov_update_cpu_data   1.895m ± ∞ ¹   1.907m ± ∞ ¹       ~ (p=0.057 n=4)
geomean                                  2.271µ         2.201µ        -3.12%
¹ need >= 6 samples for confidence interval at level 0.95

Now that we're on 1.23 we can use iterators. The existing iterators
don't really need to be modified. Allocations don't change, run time
seems a little bit faster.

    core: 1
    goos: linux
    goarch: amd64
    pkg: github.com/cilium/ebpf/btf
    cpu: 13th Gen Intel(R) Core(TM) i7-1365U
                                        │   base.txt   │              iter.txt              │
                                        │    sec/op    │    sec/op     vs base              │
    PostorderTraversal/single_type           49.79n ± ∞ ¹   48.68n ± ∞ ¹  -2.23% (p=0.029 n=4)
    PostorderTraversal/cycle(1)              146.4n ± ∞ ¹   135.8n ± ∞ ¹  -7.24% (p=0.029 n=4)
    PostorderTraversal/cycle(10)             1.928µ ± ∞ ¹   1.861µ ± ∞ ¹  -3.45% (p=0.029 n=4)
    PostorderTraversal/gov_update_cpu_data   1.895m ± ∞ ¹   1.907m ± ∞ ¹       ~ (p=0.057 n=4)
    geomean                                  2.271µ         2.201µ        -3.12%
    ¹ need >= 6 samples for confidence interval at level 0.95

Signed-off-by: Lorenz Bauer <[email protected]>
@lmb lmb marked this pull request as ready for review February 13, 2025 18:43
@lmb lmb requested a review from dylandreimerink as a code owner February 13, 2025 18:43
Copy link
Member

@dylandreimerink dylandreimerink left a comment

Choose a reason for hiding this comment

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

Nice! Neat to see how close the existing implementation already was

@lmb lmb merged commit 446714a into cilium:main Feb 14, 2025
18 checks passed
@lmb lmb deleted the btf-iterators branch February 14, 2025 11:20
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.

2 participants