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

Actually, with the help of gnulib/tests/bench.h it should be quite easy.
See tests/bench-*.c for examples of such benchmark programs.
The advantage of this approach is that it works on all platforms.

Bruno





Reply via email to