Skip to content

Commit

Permalink
Swap memmap2 in for memmap
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbabcock committed Oct 6, 2024
1 parent 8a3ae2e commit 5b627ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
31 changes: 4 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rayon = "1"
boxcars = "0.9.14"
glob = "0.3"
either = "1"
memmap = "0.7"
memmap2 = "0.9.5"
zip = { version = "2", default-features = false, features = ["deflate-zlib-ng"] }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn read_file(opt: &Opt, file_path: PathBuf) -> anyhow::Result<(PathBuf, Replay)>
// Try to mmap the file first so we don't have to worry about potentially allocating a large
// buffer in case there is like a 10GB iso file that ends in .replay
let f = fs::File::open(&file_path)?;
let mmap = unsafe { memmap::MmapOptions::new().map(&f) };
let mmap = unsafe { memmap2::MmapOptions::new().map(&f) };
match mmap {
Ok(data) => {
let replay = parse_replay(opt, &data)?;
Expand Down Expand Up @@ -255,7 +255,7 @@ fn zip(file_path: &Path, opt: &Opt) -> anyhow::Result<()> {
let (return_buf, receive_buf) = channel::<Vec<u8>>();

let f = fs::File::open(file_path)?;
let mmap = unsafe { memmap::MmapOptions::new().map(&f)? };
let mmap = unsafe { memmap2::MmapOptions::new().map(&f)? };
let zipreader = Cursor::new(&mmap);
let mut archive = zip::ZipArchive::new(zipreader)?;

Expand Down

0 comments on commit 5b627ac

Please sign in to comment.