-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Buffer LLVM's object output stream #53524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
r? @eddyb |
@@ -556,7 +556,8 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMPassManagerRef PMR, | |||
} | |||
|
|||
#if LLVM_VERSION_GE(7, 0) | |||
unwrap(Target)->addPassesToEmitFile(*PM, OS, nullptr, FileType, false); | |||
buffer_ostream BOS(OS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this is only done on 7.0+? Seems like we could do it for other LLVMs as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to muck around with older versions without testing, so I opted to leave it here (it doesn't really matter for older llvm, a slightly slower compiler is the least of those worries)
@bors r+ |
📌 Commit 9d54bf8 has been approved by |
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.
☀️ Test successful - status-appveyor, status-travis |
In some profiling on OSX I saw the
write
syscall as quite high up onthe 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.