diff options
author | Colin Cross <ccross@android.com> | 2021-06-22 15:35:23 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-06-22 15:35:24 -0700 |
commit | e387778722f93705db903aa755529568a05dd9db (patch) | |
tree | b0a33f0986d6659b73b0022e1994c7965083904e /llvm/lib/Support/ThreadPool.cpp | |
parent | 1cfdcae653140b1df5932767862a08f5a1b6106f (diff) | |
download | llvm-e387778722f93705db903aa755529568a05dd9db.zip llvm-e387778722f93705db903aa755529568a05dd9db.tar.gz llvm-e387778722f93705db903aa755529568a05dd9db.tar.bz2 |
[ELF] Optimize ScriptLexer::getLineNumber by caching the previous line number and offset
getLineNumber() was counting the number of line feeds from the start of
the buffer to the current token. For large linker scripts this became a
performance bottleneck. For one 4MB linker script over 4 minutes was
spent in getLineNumber's StringRef::count.
Store the line number from the last token, and only count the additional
line feeds since the last token.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D104137
Diffstat (limited to 'llvm/lib/Support/ThreadPool.cpp')
0 files changed, 0 insertions, 0 deletions