From 833375c0199d4e7c2555e6e9f14862ddc3ca120c Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 6 Apr 2025 21:00:43 -0400 Subject: [SharedCache] Prevent some unneeded copies when processing Also swapped out CacheEntry::m_images to a vector as its never actually used as a lookup --- view/sharedcache/core/SharedCache.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'view/sharedcache/core/SharedCache.h') diff --git a/view/sharedcache/core/SharedCache.h b/view/sharedcache/core/SharedCache.h index 3f2caed5..ff329ecf 100644 --- a/view/sharedcache/core/SharedCache.h +++ b/view/sharedcache/core/SharedCache.h @@ -136,11 +136,11 @@ class CacheEntry std::vector m_mappings {}; // Mapping of image path to image info, used within ProcessImagesAndRegions to add them to the cache. // Also used to retrieve the image dependencies. - std::unordered_map m_images {}; + std::vector> m_images {}; public: CacheEntry(std::string filePath, std::string fileName, CacheEntryType type, dyld_cache_header header, - std::vector mappings, std::unordered_map images); + std::vector mappings, std::vector> images); CacheEntry() = default; @@ -173,7 +173,7 @@ public: const std::string GetFileName() const { return m_fileName; } const dyld_cache_header& GetHeader() const { return m_header; } const std::vector& GetMappings() const { return m_mappings; } - const std::unordered_map& GetImages() const { return m_images; } + const std::vector>& GetImages() const { return m_images; } }; // The ID for a given CacheEntry, use this instead of passing a pointer around to avoid complexity :V @@ -227,10 +227,10 @@ public: const std::unordered_map& GetSymbols() const { return m_symbols; } const std::unordered_map& GetNamedSymbols() const { return m_namedSymbols; } - void AddImage(CacheImage image); + void AddImage(CacheImage&& image); // Add a region that may overlap with another. - void AddRegion(CacheRegion region); + void AddRegion(CacheRegion&& region); void AddSymbol(CacheSymbol symbol); -- cgit v1.3.1