btrace(8): cache ELF .symtab, .strtab entries in sorted array
Currently, every kelf_snprintsym() call performs a linear search
through the .symtab for a matching symbol. The search is very
costly and causes btrace(8) to drop a lot of profiling events.
Storing the STT_FUNC .symtab entries and their corresponding .strtab
entries in a sorted array cuts the lookup cost from O(n) to O(lg n).
Lower overhead reduces the drop rate for profiling events.
With tweaks from mpi@.
Thread: https://marc.info/?l=openbsd-tech&m=
170830125132105&w=2
probably ok mpi@