From 29792a82a9ed7733e76eb8ef30fa27fa6f606c45 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 19 Jun 2015 21:25:44 +0000 Subject: [PATCH] COFF: Cache Archive::Symbol::getName(). NFC. getName() does strlen() on the symbol table, so it's not very fast. It's not as bad as r239332 because the number of symbols exported from archive files are fewer than object files, and they are usually shorter, though. llvm-svn: 240178 --- lld/COFF/InputFiles.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index 1d4db89..4499395 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -61,10 +61,10 @@ std::error_code ArchiveFile::parse() { // Read the symbol table to construct Lazy objects. uint32_t I = 0; for (const Archive::Symbol &Sym : File->symbols()) { + auto *B = new (&Buf[I++]) Lazy(this, Sym); // Skip special symbol exists in import library files. - if (Sym.getName() == "__NULL_IMPORT_DESCRIPTOR") - continue; - SymbolBodies.push_back(new (&Buf[I++]) Lazy(this, Sym)); + if (B->getName() != "__NULL_IMPORT_DESCRIPTOR") + SymbolBodies.push_back(B); } return std::error_code(); } -- 2.7.4