Frank Ch. Eigler wrote:
Hi -
On Wed, Oct 08, 2008 at 09:13:01AM -0700, Ulrich Drepper wrote:
>> It turns out that most of the time is spend iterating inline instances
>> (dwarf_func_inline_instances). So I created a straightforward cache
>> that simply finds all the inline instances in given CU, and stuffs them
>> into one array. [...]
> So, why not provide an iterator over the inline functions and have
> the caller create whatever data structure they need? This seems
> more generic since then the search can be customized.
(So something along the lines of dwarf_all_func_inline_instances.)
That's possible, but would force yet more caching into the
client
side. The more foreseeable caching opportunities should be centrally
provided instead of duplicated.
I know that Roland had a plan related to systematic handling of
out-of-memory conditions in libdwfl (or maybe in elfutils as a whole?).
I suppose some sort of intelligent cache maintenance (drop LRU, or
altogether user-controllable) fits into that project.
> Plus, it doesn't punish users which make only a few such
calls.
If the cache is populated during the first actual call, then its
presence need not punish users.
That's how it's done. It will still punish users who do e.g. only one
call in a given CU. The cache setup is not for free, and will start to
pay off only after several calls.
PM