Skip to content

Commit fbd3a18

Browse files
author
Devdutt Shenoi
committed
perf: use a buffer
1 parent b8606b3 commit fbd3a18

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/parseable/staging/writer.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
*/
1919

2020
use std::{
21-
collections::{HashMap, HashSet},
22-
fs::{File, OpenOptions},
23-
path::PathBuf,
24-
sync::Arc,
21+
collections::{HashMap, HashSet}, fs::{File, OpenOptions}, io::BufWriter, path::PathBuf, sync::Arc
2522
};
2623

2724
use arrow_array::RecordBatch;
@@ -42,15 +39,15 @@ pub struct Writer {
4239
}
4340

4441
pub struct DiskWriter {
45-
pub inner: StreamWriter<File>,
42+
pub inner: StreamWriter<BufWriter<File>>,
4643
pub path: PathBuf,
4744
}
4845

4946
impl DiskWriter {
5047
pub fn new(path: PathBuf, schema: &Schema) -> Result<Self, StagingError> {
5148
let file = OpenOptions::new().create(true).append(true).open(&path)?;
5249

53-
let inner = StreamWriter::try_new(file, schema)?;
50+
let inner = StreamWriter::try_new_buffered(file, schema)?;
5451

5552
Ok(Self { inner, path })
5653
}

0 commit comments

Comments
 (0)