From c22d54c5d95f4d23629484579414387b0c7503ee Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 6 Apr 2025 20:00:00 -0400 Subject: [SharedCache] Replace write log with callback registration for reapplying slide info This improves performance by ~10x with the only real issue being a copy of the cache entry existing for each weak ref. Also fixes - Some old TODO's that are no longer relevant - Some function signatures not being const - FileAccessorCache not evicting enough accessors to fit under an adjusted cache size - Added a warning if we are over the global cache size in view initialization - Logger name not having a `.` in `SlideInfoProcessor::SlideInfoProcessor` - Re-added the accessor dirty check before applying slide info to fix https://github.com/Vector35/binaryninja-api/issues/6570 --- view/sharedcache/core/SharedCacheView.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'view/sharedcache/core/SharedCacheView.cpp') diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp index a3e494e2..00caddd2 100644 --- a/view/sharedcache/core/SharedCacheView.cpp +++ b/view/sharedcache/core/SharedCacheView.cpp @@ -787,7 +787,8 @@ bool SharedCacheView::Init() bool result = cacheProcessor.ProcessCache(sharedCache); auto endTime = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = endTime - startTime; - logger->LogInfo("Processing %zu entries took %.3f seconds", sharedCache.GetEntries().size(), elapsed.count()); + auto entryCount = sharedCache.GetEntries().size(); + logger->LogInfo("Processing %zu entries took %.3f seconds", entryCount, elapsed.count()); if (!result) { @@ -800,6 +801,10 @@ bool SharedCacheView::Init() // Skip all the other shared cache stuff. return true; } + + // If we can't store all of our files for this cache in the accessor cache we might run into issues, warn the user. + if (entryCount > FileAccessorCache::Global().GetCacheSize()) + logger->LogWarn("Cache contains more entries than the allowed number of opened file handles, this may impact reliability."); } { -- cgit v1.3.1