Skip to content

Commit 912776f

Browse files
bors[bot]lnicola
andauthored
Merge #2916
2916: Buffer reads from cargo check's stdout r=matklad a=lnicola `Stdio::piped()` is unbuffered, which caused RA to read the output of `cargo check` one byte at a time (out of 114KB in my test). This isn't obviously faster on my system, but making fewer syscalls sounds like a good idea. Co-authored-by: Laurențiu Nicola <[email protected]>
2 parents 5dd8f8e + c34571c commit 912776f

File tree

1 file changed

+4
-1
lines changed
  • crates/ra_cargo_watch/src

1 file changed

+4
-1
lines changed

crates/ra_cargo_watch/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use lsp_types::{
99
};
1010
use std::{
1111
collections::HashMap,
12+
io::BufReader,
1213
path::PathBuf,
1314
process::{Command, Stdio},
1415
sync::Arc,
@@ -347,7 +348,9 @@ impl WatchThread {
347348
// which will break out of the loop, and continue the shutdown
348349
let _ = message_send.send(CheckEvent::Begin);
349350

350-
for message in cargo_metadata::parse_messages(command.stdout.take().unwrap()) {
351+
for message in
352+
cargo_metadata::parse_messages(BufReader::new(command.stdout.take().unwrap()))
353+
{
351354
let message = match message {
352355
Ok(message) => message,
353356
Err(err) => {

0 commit comments

Comments
 (0)