initial commit
This commit is contained in:
commit
19db836ec0
4 changed files with 48 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
16
Cargo.lock
generated
Normal file
16
Cargo.lock
generated
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "disk-read-benchmark"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"xxhash-rust",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "xxhash-rust"
|
||||||
|
version = "0.8.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984"
|
7
Cargo.toml
Normal file
7
Cargo.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "disk-read-benchmark"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
xxhash-rust = {version = "*", features = ["xxh3"]}
|
24
src/main.rs
Normal file
24
src/main.rs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
use std::{
|
||||||
|
fs,
|
||||||
|
io::{BufReader, Read, Write},
|
||||||
|
};
|
||||||
|
use xxhash_rust::xxh3::xxh3_128;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let filename = "/home/askiiart/whyy/testing/stuff-100M";
|
||||||
|
let mut stuff = fs::File::open(filename).unwrap();
|
||||||
|
let file_size: u64 = stuff.metadata().unwrap().len();
|
||||||
|
|
||||||
|
let mut buf = BufReader::new(stuff);
|
||||||
|
let mut out = fs::File::create("output").unwrap();
|
||||||
|
|
||||||
|
let mut data = [0; 16];
|
||||||
|
buf.read_exact(&mut data);
|
||||||
|
out.write(&xxh3_128(&data).to_be_bytes());
|
||||||
|
let mut location: u64 = 0;
|
||||||
|
while location <= file_size / 16 {
|
||||||
|
buf.read_exact(&mut data);
|
||||||
|
location += 1;
|
||||||
|
out.write(&xxh3_128(&data).to_be_bytes());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue