pyelftools icon indicating copy to clipboard operation
pyelftools copied to clipboard

Skip the cache of DWARFInfo and CU.

Open ThinkerYzu opened this issue 1 year ago • 2 comments

Add DWARFInfo.skip_cache() and DWARFInfo.enable_cache() to give users the ability of controlling cache.

For the case of parsing the DWARF of a large binary, we may want to skip the cache to release the memory ASAP, avoiding extra CPU cycles on maintaining a cache.

One of my use cases is to extract types, functions, and call sites from the DWARF of a Linux kernel image. With caches, it takes about 573 seconds to go through all DIEs. Skipping caches reduces time to 448 seconds. It is about 27% faster. When going through every DIEs sequentially, cache doesn't help use at all.

ThinkerYzu avatar Feb 12 '24 04:02 ThinkerYzu