Closed akyrtzi closed 5 days ago
Explanation: When compilation is performed with Clang caching enabled, there's a MirroringOutputBackend
used that forces the raw_ostream
s for the outputs to be unbuffered, causing significant slowdown due to I/O, that is measurable when building Clang or WebKit projects. Original author (Duncan Exon Smith) does not remember the significance of disabling buffering, but I couldn't find any issue with allowing the raw_ostream
s to be buffered. The overhead goes away with this change.
Radar (and possibly SR Issue): rdar://130514092
Scope: Affects compilations with Clang caching enabled
Risk: None anticipated
Testing: Local testing with projects
Reviewed By: Steven Wu
@swift-ci Please test
MirroringOutputBackend
was forcing theraw_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 (cherry picked from commit d87edc2fde10542ada0bd7b2fb30555375df7b70)