Speed up SymbolTable::insert().
SymbolTable::insert() is a hot path function. When linking a clang debug build, the function is called 3.7 million times. The total amount of "Name" string contents is 300 MiB. That means this `Name.find("@@")` scans almost 300 MiB of data. That's far from negligible. StringRef::find(StringRef) uses a sophisticated algorithm, but the function is slow for a short needle. This patch replaces it with StringRef::find(char). This patch alone speeds up a clang debug build link time by 0.5 seconds from 8.2s to 7.7s. That's 6% speed up. It seems too good for this tiny change, but looks like it's real. llvm-svn: 314192
Loading
Please register or sign in to comment