[Object] Avoid repeated hash lookups (NFC) (#127746)

This commit is contained in:
Kazu Hirata 2025-02-19 08:21:10 -08:00 committed by GitHub
parent af922cf9f7
commit 1bb72f0d7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -503,8 +503,9 @@ GOFFObjectFile::getSectionContents(DataRefImpl Sec) const {
std::copy(CompleteData.data(), CompleteData.data() + TxtDataSize,
Data.begin() + TxtDataOffset);
}
SectionDataCache[Sec.d.a] = Data;
return ArrayRef<uint8_t>(SectionDataCache[Sec.d.a]);
auto &Cache = SectionDataCache[Sec.d.a];
Cache = Data;
return ArrayRef<uint8_t>(Cache);
}
uint64_t GOFFObjectFile::getSectionAlignment(DataRefImpl Sec) const {