[all-commits] [llvm/llvm-project] 0db402: [lld] Buffer writes when composing a single diagno...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Thu Sep 9 09:27:26 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0db402c5b4ef60ca8d20dda8bb59c7288a534e2a
https://github.com/llvm/llvm-project/commit/0db402c5b4ef60ca8d20dda8bb59c7288a534e2a
Author: Fangrui Song <i at maskray.me>
Date: 2021-09-09 (Thu, 09 Sep 2021)
Changed paths:
M lld/Common/ErrorHandler.cpp
M lld/include/lld/Common/ErrorHandler.h
M llvm/include/llvm/Support/raw_ostream.h
Log Message:
-----------
[lld] Buffer writes when composing a single diagnostic
llvm::errs() is unbuffered. On a POSIX platform, composing a diagnostic
string may invoke the ::write syscall multiple times, which can be slow.
Buffer writes to a temporary SmallString when composing a single diagnostic to
reduce the number of ::write syscalls to one (also easier to read under
strace/truss).
For an invocation of ld.lld with 62000+ lines of
`ld.lld: warning: symbol ordering file: no such symbol: ` warnings (D87121),
the buffering decreases the write time from 1s to 0.4s (for /dev/tty) and
from 0.4s to 0.1s (for a tmpfs file). This can speed up
`relocation R_X86_64_PC32 out of range` diagnostic printing as well
with `--noinhibit-exec --no-fatal-warnings`.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D87272
More information about the All-commits
mailing list