Skip to content

Commit

Permalink
Remove memory-mapped I/O even on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Oct 19, 2023
1 parent 77eaf11 commit b49c506
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
10 changes: 0 additions & 10 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions crates/subspace-farmer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,5 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
ulid = { version = "1.0.0", features = ["serde"] }
zeroize = "1.6.0"

[target.'cfg(windows)'.dependencies]
memmap2 = "0.9.0"

[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
monoio = { version = "0.1.10-beta.1", features = ["sync"] }
14 changes: 1 addition & 13 deletions crates/subspace-farmer/src/single_disk_farm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,23 +1024,11 @@ impl SingleDiskFarm {
}
}

#[cfg(not(windows))]
let plot_audit = &SyncPlotAudit::new(&*plot_file);
#[cfg(windows)]
let plot_mmap = unsafe {
memmap2::Mmap::map(&*plot_file).map_err(FarmingError::from)?
};
// On Windows random read is horrible in terms of performance, memory-mapped I/O helps
// TODO: Remove this once https://internals.rust-lang.org/t/introduce-write-all-at-read-exact-at-on-windows/19649
// or similar exists in standard library
#[cfg(windows)]
let plot_audit = &SyncPlotAudit::new(&*plot_mmap);

let farming_options = FarmingOptions {
public_key,
reward_address,
node_client,
plot_audit,
plot_audit: &SyncPlotAudit::new(&*plot_file),
sectors_metadata,
kzg,
erasure_coding,
Expand Down

0 comments on commit b49c506

Please sign in to comment.