Re: [PATCH bpf-next v9 10/10] libbpf: Optimize the performance of determine_ptr_size

From: Eduard Zingerman

Date: Wed Dec 17 2025 - 02:07:04 EST


On Mon, 2025-12-08 at 14:23 +0800, Donglin Peng wrote:
> From: pengdonglin <pengdonglin@xxxxxxxxxx>
>
> Leverage the performance improvement of btf__find_by_name_kind() when
> BTF is sorted. For sorted BTF, the function uses binary search with
> O(log n) complexity instead of linear search, providing significant
> performance benefits, especially for large BTF like vmlinux.

Is this a big win?
I don't like having two code paths for something which is done once
per BTF load. If it is a big win, maybe just stick with the first loop
(the one that uses btf__find_by_name_kind())? Wdyt?

[...]