Bruno Haible via Gnulib discussion list <[email protected]> writes:

> Reuben Thomas wrote:
>> > The next question is: How costly is this dladdr() call? Would it therefore
>> > make sense to enable ENABLE_COSTLY_RELOCATABLE by default on more
>> > platforms?
>> >
>> 
>> I don't know. I had a quick look at the source for glibc, which seems to
>> involve linear scans of a) a linked list and b) the buckets of a hash
>> table, but I have no idea how big those lists are. I was wondering before
>> about doing some testing with perf, but I'm a novice here; does perf even
>> count instructions executed before main?
>> 
>> The implementation I linked for AIX above seems to be similar: a linear
>> scan through a linked list. Again, I would guess that the main BSDs would
>> have similar implementations.
>
> "Linear list" sounds reasonable. But can you actually measure it?
> 'perf' is by far not the only tool for this job; see
> https://gitlab.com/ghwiki/gnow-how/-/wikis/Profiling/with_sampling

Not really related to the current discussion, but you may want to add an
example of 'perf stat' to that page. I have used it many times when
testing changes in Coreutils, the posix_spawn changes are an example [1].

I especially like the '--repeat <COUNT>' option, to compare the average
of multiple invocations of the command, instead of assuming a single run
is representitive of the norm.

Collin

[1] https://lists.gnu.org/archive/html/coreutils/2025-10/msg00087.html

Reply via email to