reader buf 100M => 4K
This commit is contained in:
@@ -238,7 +238,7 @@ fn read_from_db2(id: u32) -> Option<Question> {
|
||||
let cfg = bincode::config::standard();
|
||||
|
||||
let input = fs::File::open("test.bin").expect("open input");
|
||||
let mut input = std::io::BufReader::with_capacity(100 * 1024 * 1024, input);
|
||||
let mut input = std::io::BufReader::with_capacity(4 * 1024, input);
|
||||
|
||||
let mut len_data: [u8; LEN_SIZE] = [0; LEN_SIZE];
|
||||
input.read_exact(&mut len_data).expect("read len");
|
||||
@@ -273,7 +273,7 @@ fn read_from_db2(id: u32) -> Option<Question> {
|
||||
.read_exact(&mut pos_curr_data)
|
||||
.expect("read current pos");
|
||||
input.read_exact(&mut pos_next_data).expect("read next pos");
|
||||
|
||||
|
||||
let data_pos = u32::from_le_bytes(pos_curr_data);
|
||||
let data_pos_next = u32::from_le_bytes(pos_next_data);
|
||||
let data_len = data_pos_next - data_pos;
|
||||
|
Reference in New Issue
Block a user