[PATCH] D87272: [lld] Buffer writes when composing a single diagnostic

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 14:36:15 PDT 2020


dblaikie added a comment.

In D87272#2312896 <https://reviews.llvm.org/D87272#2312896>, @MaskRay wrote:

> In D87272#2312865 <https://reviews.llvm.org/D87272#2312865>, @dblaikie wrote:
>
>> (side note: raw_ostream already has buffering support - any idea why its performance is still significantly different than the extra layer of buffering on top of it? Might be a matter of enabling buffering in lld::errs() (lld::errs().SetBufferSize(N))? That'd still work with colored output without any troubles (it'd be flushed as needed on platforms where flushing is needed). I still think if there are use cases where the performance of errors matters to users - they probably should be addressed in other ways, though, such as being able to disable warnings the user isn't interested in)
>
> (reply to side note: `llvm::errs() << "..."` does not use buffering. Every print is a `write` syscall on POSIX systems. The idea of the patch is to greatly reduce the number of `write` syscalls. Enabling buffering for `llvm::errs()` may have the side effect that an error can be reported far away from its call site. For certain warnings/errors (e.g. after all input has been read) this probably does not matter that much.)
>
> raw_ostream does not have a line buffering mode.

Not line buffering, but it does have support for general purpose buffering - if there are particular places where the output must be generated (though I can't think of any in a linker or compiler - they don't accept interactive input, so they don't need to make sure some output is rendered to the user before waiting to read input, for instance) then it could/should be explicitly flushed at those locations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87272/new/

https://reviews.llvm.org/D87272



More information about the llvm-commits mailing list