perf: Use io::copy for SkipBytesFilter
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use super::FilterPlugin;
|
||||
use std::io::{Result, Read, Write, BufRead, Seek};
|
||||
use std::io::{Result, Read, Write, BufRead};
|
||||
use crate::common::PIPESIZE;
|
||||
|
||||
pub struct SkipBytesFilter {
|
||||
@@ -29,15 +29,8 @@ impl FilterPlugin for SkipBytesFilter {
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the remaining data
|
||||
let mut buffer = vec![0; PIPESIZE];
|
||||
loop {
|
||||
let bytes_read = reader.read(&mut buffer)?;
|
||||
if bytes_read == 0 {
|
||||
break;
|
||||
}
|
||||
writer.write_all(&buffer[..bytes_read])?;
|
||||
}
|
||||
// Copy the remaining data using io::copy for efficiency
|
||||
std::io::copy(reader, writer)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user