Skip to content

Commit d87edc2

Browse files
committed
[llvm/Support/VirtualOutputBackends] Don't create unbuffered streams when the MirroringOutputBackend is used
`MirroringOutputBackend` was forcing the `raw_ostream`s to be unbuffered, causing significant slowdown due to I/O. When enabling Clang caching for building Clang or WebKit, the "from scratch" (all cache misses) build was slower than the regular non-caching build. For building debug Clang the overhead was ~22%, and for debug build of WebKit, it was ~15%. The overhead went away after removing the `SetUnbuffered()` calls. rdar://130514092
1 parent dbeaf5a commit d87edc2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

llvm/lib/Support/VirtualOutputBackends.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,7 @@ vfs::makeMirroringOutputBackend(IntrusiveRefCntPtr<OutputBackend> Backend1,
123123
std::unique_ptr<OutputFileImpl> F2)
124124
: PreferredBufferSize(std::max(F1->getOS().GetBufferSize(),
125125
F1->getOS().GetBufferSize())),
126-
F1(std::move(F1)), F2(std::move(F2)) {
127-
// Don't double buffer.
128-
this->F1->getOS().SetUnbuffered();
129-
this->F2->getOS().SetUnbuffered();
130-
}
126+
F1(std::move(F1)), F2(std::move(F2)) {}
131127
size_t PreferredBufferSize;
132128
std::unique_ptr<OutputFileImpl> F1;
133129
std::unique_ptr<OutputFileImpl> F2;

0 commit comments

Comments
 (0)