[PATCH] D78950: Adds LRU caching of compile units in DWARFContext.

Hyoun Kyu Cho via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 17:48:54 PDT 2020


netforce added a comment.

In D78950#2006434 <https://reviews.llvm.org/D78950#2006434>, @aprantl wrote:

> Do you think this is always a win, i.e., also for LLDB, or should this be done in a higher layer?


In terms of memory usage, this will always make it smaller or equal to the current implementation except the small amount used for the LRU data structure. It could increase execution time or CPU usage, since it is possible that some compile units needs to be parsed multiple times due to the cache eviction. How much it is affected depends on the access pattern of the information. In our use case of llvm-symbolizer and our own symbolization library, it could save huge memory with reasonable degradation of CPU usage.

Since DWARFContext is used as entry point of the API, I thought it makes sense to place the caching functionality there. Although I'm not very familiar with LLDB, if this hurts the performance if it, it can opt out of using the caching by giving negative LRUSize when creating DWARFContext.

In case reviewers agree that it makes more sense to put it in a higher layer, I believe that's possible too after making a couple private member functions public.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78950/new/

https://reviews.llvm.org/D78950





More information about the llvm-commits mailing list