[PATCH] D64969: [llvm-objdump][NFC] Make the PrettyPrinter::printInst() output buffered

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 23:07:57 PDT 2019


MaskRay added a comment.

Nice finding!

> [1]: https://github.com/llvm/llvm-project/blob/2946cd701067404b99c39fb29dc9c74bd7193eb3/llvm/include/llvm/Support/FormattedStream.h#L83

I think the 4x (line buffered vs unbuffered) slowdown can be explained by your first link. The formatted_raw_ostream ctor resets the underlying stream (`outs()`) to unbuffered. There are several solutions to the problem. Given `formatted_raw_ostream FOS(OS);` is only used once in PrettyPrinter and can be easily replaced, I suggest deleting it and tracking the column manually.


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

https://reviews.llvm.org/D64969





More information about the llvm-commits mailing list