Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
3 changed files
with
25 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters