Buffer LLVM's object output stream
In some profiling on OSX I saw the `write` syscall as quite high up on the profiling graph, which is definitely not good! It looks like we're setting the output stream of an object file as directly to a file descriptor which means that we run the risk of doing lots of little writes rather than a few large writes. This commit fixes this issue by adding a buffered stream on the output, causing the `write` syscall to disappear from the profiles on OSX.
This commit is contained in:
@@ -556,7 +556,8 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMPassManagerRef PMR,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if LLVM_VERSION_GE(7, 0)
|
#if LLVM_VERSION_GE(7, 0)
|
||||||
unwrap(Target)->addPassesToEmitFile(*PM, OS, nullptr, FileType, false);
|
buffer_ostream BOS(OS);
|
||||||
|
unwrap(Target)->addPassesToEmitFile(*PM, BOS, nullptr, FileType, false);
|
||||||
#else
|
#else
|
||||||
unwrap(Target)->addPassesToEmitFile(*PM, OS, FileType, false);
|
unwrap(Target)->addPassesToEmitFile(*PM, OS, FileType, false);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user