reader buf 100M => 4K

This commit is contained in:
Dmitry Belyaev 2022-10-07 16:09:44 +03:00
parent 16784a3319
commit 7ee0b62ed7
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3
2 changed files with 11 additions and 11 deletions

View File

@ -6,18 +6,18 @@
hyperfine -n print -n print2 -n zip-print -w 100 -m 100 ".\target\release\chgk_ledb.exe print 444" ".\target\release\chgk_ledb.exe print2 444" ".\target\release\chgk_ledb.exe zip-print 4 84" hyperfine -n print -n print2 -n zip-print -w 100 -m 100 ".\target\release\chgk_ledb.exe print 444" ".\target\release\chgk_ledb.exe print2 444" ".\target\release\chgk_ledb.exe zip-print 4 84"
Benchmark 1: print Benchmark 1: print
Time (mean ± σ): 17.7 ms ± 2.0 ms [User: 4.3 ms, System: 13.3 ms] Time (mean ± σ): 16.9 ms ± 5.0 ms [User: 5.5 ms, System: 13.4 ms]
Range (min … max): 15.7 ms … 32.0 ms 100 runs Range (min … max): 14.5 ms … 65.1 ms 107 runs
Benchmark 2: print2 Benchmark 2: print2
Time (mean ± σ): 62.2 ms ± 4.3 ms [User: 5.6 ms, System: 53.1 ms] Time (mean ± σ): 16.4 ms ± 5.2 ms [User: 4.9 ms, System: 13.2 ms]
Range (min … max): 58.1 ms … 94.5 ms 100 runs Range (min … max): 13.9 ms … 67.5 ms 110 runs
Benchmark 3: zip-print Benchmark 3: zip-print
Time (mean ± σ): 37.0 ms ± 6.1 ms [User: 12.0 ms, System: 20.8 ms] Time (mean ± σ): 38.3 ms ± 7.4 ms [User: 13.5 ms, System: 22.1 ms]
Range (min … max): 32.3 ms … 94.3 ms 100 runs Range (min … max): 32.8 ms … 91.7 ms 100 runs
Summary Summary
'print' ran 'print2' ran
2.08 ± 0.41 times faster than 'zip-print' 1.04 ± 0.45 times faster than 'print'
3.50 ± 0.46 times faster than 'print2' 2.35 ± 0.87 times faster than 'zip-print'

View File

@ -238,7 +238,7 @@ fn read_from_db2(id: u32) -> Option<Question> {
let cfg = bincode::config::standard(); let cfg = bincode::config::standard();
let input = fs::File::open("test.bin").expect("open input"); 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]; let mut len_data: [u8; LEN_SIZE] = [0; LEN_SIZE];
input.read_exact(&mut len_data).expect("read len"); input.read_exact(&mut len_data).expect("read len");