Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

Copy engine sized by disk kind, with a hand-chosen kind per drive

gelenmedyaa575c966c1dd
diff --git a/crates/rf-app/src/i18n_en.rs b/crates/rf-app/src/i18n_en.rs
index 8b9cabee..1d550d30 100644
--- a/crates/rf-app/src/i18n_en.rs
+++ b/crates/rf-app/src/i18n_en.rs
@@ -1212,6 +1212,18 @@ pub const EN: &[(&str, &str)] = &[
("Commit tarihi", "Commit date"),
("Commit hash", "Commit hash"),
("Hızlı dosya işlemleri", "Fast file operations"),
+ ("Sabit disk (HDD)", "Hard disk (HDD)"),
+ ("SATA SSD", "SATA SSD"),
+ ("NVMe SSD", "NVMe SSD"),
+ ("DRAM'siz NVMe SSD", "DRAM-less NVMe SSD"),
+ ("USB bellek, hafıza kartı", "USB stick, memory card"),
+ ("Windows'un bildirdiği", "What Windows reports"),
+ ("Kopyalamada disk türleri", "Disk kinds for copying"),
+ ("Kopyalama motoru her sürücüde aynı anda kaç dosya kopyalayacağını diskin türüne göre seçer: dönen diskte tek tek, SSD'de birçoğunu birden. Otomatik, Windows'un bildirdiğini kullanır.", "The copy engine chooses how many files it copies at once on each drive by the kind of disk: one at a time on a spinning disk, many on an SSD. Automatic uses what Windows reports."),
+ ("Windows bunu dönen bir disk olarak bildiriyor: aynı anda birden çok dosya kopyalamak kafayı dosyalar arasında gezdirir ve kopyaları çok yavaşlatabilir.", "Windows reports this as a spinning disk: copying several files at once makes its head jump between them and can slow copies down a lot."),
+ ("Windows bunu DRAM'siz bir SSD olarak bildiriyor: büyük kopyalarda diskin önbelleği dolunca hız düşebilir.", "Windows reports this as a DRAM-less SSD: in big copies the speed can drop once the disk's cache is full."),
+ ("Windows bunu dönen bir disk olarak bildirmiyor: dosyalar tek tek kopyalanır, kopyalar gereğinden yavaş olur.", "Windows doesn't report this as a spinning disk: files are copied one at a time, and copies are slower than they need to be."),
+ ("Windows bu sürücüyü başka bir tür olarak bildiriyor; kopyalama hızı seçtiğiniz türe göre ayarlanır.", "Windows reports this drive as another kind; copying is set up for the kind you chose."),
("Kopyalama, başka sürücüye taşıma ve kalıcı silme kendi paralel motorumuzla. Kapalıyken her şey Windows'un motoruyla yapılır.", "Copying, moving to another drive and permanent deletion use our own parallel engine. When off, Windows' engine does everything."),
("Çalıştır", "Run"),
("Sabitle", "Pin"),
diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rs
index ab069a1b..aff52453 100644
--- a/crates/rf-app/src/settings.rs
+++ b/crates/rf-app/src/settings.rs
@@ -934,6 +934,10 @@ pub struct Settings {
/// Our own parallel engine for copies, moves to other drives and permanent deletes
/// (off: Windows' engine for everything, like Explorer).
pub fast_file_ops: bool,
+ /// Disk kinds chosen by hand for the copy engine, by drive ("E:"): they win over what Windows reports (Settings › Advanced ›
+ /// Disk kinds for copying). A drive not named here is detected.
+ #[serde(default)]
+ pub copy_disk_kinds: std::collections::BTreeMap<String, rf_win::drives::DiskKind>,
/// To the Recycle Bin by renaming each item into it on NTFS drives (`rf_win::fastrecycle`), instead of Windows' engine, which
/// takes ~47 s for 20,000 files. Its own switch, so it can be turned off by itself if it ever misbehaves on a PC.
pub fast_recycle: bool,
@@ -1394,6 +1398,7 @@ impl Default for Settings {
folder_sizes_everything: false,
folder_size_on_disk: false,
fast_file_ops: true,
+ copy_disk_kinds: Default::default(),
fast_recycle: true,
copy_verify: CopyVerify::Off,
wsl_drop_zone: false,
diff --git a/crates/rf-app/src/settings_view.rs b/crates/rf-app/src/settings_view.rs
index c7374e40..6363fb0f 100644
--- a/crates/rf-app/src/settings_view.rs
+++ b/crates/rf-app/src/settings_view.rs
@@ -508,6 +508,114 @@ pub(crate) fn card(p: &Palette, icon: L, title: &str, desc: Option<&str>, contro
.into_any_element()
}
+/// A disk kind's name, as Settings shows it.
+fn disk_kind_name(kind: rf_win::drives::DiskKind) -> &'static str {
+ use rf_win::drives::DiskKind::*;
+ match kind {
+ Hdd => t!("Sabit disk (HDD)"),
+ SataSsd => t!("SATA SSD"),
+ NvmeSsd => t!("NVMe SSD"),
+ DramlessSsd => t!("DRAM'siz NVMe SSD"),
+ UsbStick => t!("USB bellek, hafıza kartı"),
+ Network => t!("Ağ"),
+ Unknown => t!("Bilinmiyor"),
+ }
+}
+
+/// What to say when the kind chosen by hand is not the one Windows reports: what the choice costs.
+fn disk_kind_warning(detected: rf_win::drives::DiskKind, chosen: rf_win::drives::DiskKind) -> Option<&'static str> {
+ use rf_win::drives::DiskKind::*;
+ if detected == chosen || detected == Unknown {
+ return None;
+ }
+ Some(match (detected, chosen) {
+ (Hdd, _) => t!("Windows bunu dönen bir disk olarak bildiriyor: aynı anda birden çok dosya kopyalamak kafayı dosyalar arasında gezdirir ve kopyaları çok yavaşlatabilir."),
+ (DramlessSsd, NvmeSsd) => t!("Windows bunu DRAM'siz bir SSD olarak bildiriyor: büyük kopyalarda diskin önbelleği dolunca hız düşebilir."),
+ (_, Hdd) => t!("Windows bunu dönen bir disk olarak bildirmiyor: dosyalar tek tek kopyalanır, kopyalar gereğinden yavaş olur."),
+ _ => t!("Windows bu sürücüyü başka bir tür olarak bildiriyor; kopyalama hızı seçtiğiniz türe göre ayarlanır."),
+ })
+}
+
+/// The drives the copy engine sizes its work for, each with what Windows reports (read once a minute at most: a query per drive is
+/// a few device calls, not something to do on every frame).
+fn detected_disks() -> Vec<(String, String, rf_win::drives::DiskKind)> {
+ use std::sync::Mutex;
+ use std::time::{Duration, Instant};
+ static SEEN: Mutex<Option<(Instant, Vec<(String, String, rf_win::drives::DiskKind)>)>> = Mutex::new(None);
+ let mut seen = SEEN.lock().unwrap_or_else(|e| e.into_inner());
+ if let Some((when, list)) = seen.as_ref()
+ && when.elapsed() < Duration::from_secs(60)
+ {
+ return list.clone();
+ }
+ let list: Vec<(String, String, rf_win::drives::DiskKind)> = rf_win::drives::list_drives()
+ .into_iter()
+ .filter(|d| matches!(d.kind, rf_win::drives::DriveKind::Fixed | rf_win::drives::DriveKind::Removable))
+ .map(|d| {
+ let info = rf_win::drives::disk_info(&d.root);
+ let name = info.model.clone().unwrap_or_else(|| d.label.clone());
+ (format!("{}:", d.letter.to_ascii_uppercase()), name, rf_win::drives::kind_from(&info))
+ })
+ .collect();
+ *seen = Some((Instant::now(), list.clone()));
+ list
+}
+
+/// Settings › Advanced › Disk kinds for copying: each drive, what Windows reports, and the kind the copy engine uses (Automatic, or
+/// one chosen by hand, with a warning when it is not what Windows reports).
+fn disk_kinds(p: &Palette, s: &Settings, cx: &mut App) -> AnyElement {
+ let chosen = s.copy_disk_kinds.clone();
+ let pp = *p;
+ expander(
+ "disk-kinds",
+ p,
+ L::HardDrive,
+ t!("Kopyalamada disk türleri"),
+ Some(t!("Kopyalama motoru her sürücüde aynı anda kaç dosya kopyalayacağını diskin türüne göre seçer: dönen diskte tek tek, SSD'de birçoğunu birden. Otomatik, Windows'un bildirdiğini kullanır.")),
+ None,
+ move || {
+ detected_disks()
+ .into_iter()
+ .map(|(drive, model, detected)| {
+ let current = chosen.get(&drive).copied();
+ let label: SharedString = match current {
+ None => format!("{} ({})", t!("Otomatik"), disk_kind_name(detected)).into(),
+ Some(k) => disk_kind_name(k).into(),
+ };
+ let key = drive.clone();
+ let picker = select_box(SharedString::from(format!("disk-kind-{drive}")), &pp, label, move |_| {
+ let mut out = vec![{
+ let key = key.clone();
+ Choice::new(format!("{} ({})", t!("Otomatik"), disk_kind_name(detected)), current.is_none(), move |_, cx| {
+ let key = key.clone();
+ settings::update(cx, move |s| {
+ s.copy_disk_kinds.remove(&key);
+ })
+ })
+ }];
+ for kind in rf_win::drives::DiskKind::CHOICES {
+ let key = key.clone();
+ out.push(Choice::new(disk_kind_name(kind).to_string(), current == Some(kind), move |_, cx| {
+ let key = key.clone();
+ settings::update(cx, move |s| {
+ s.copy_disk_kinds.insert(key, kind);
+ })
+ }));
+ }
+ out
+ });
+ let mut desc = format!("{model} · {}: {}", t!("Windows'un bildirdiği"), disk_kind_name(detected));
+ if let Some(w) = current.and_then(|c| disk_kind_warning(detected, c)) {
+ desc = format!("{desc}\n⚠ {w}");
+ }
+ card(&pp, L::HardDrive, &drive, Some(&desc), picker)
+ })
+ .collect()
+ },
+ cx,
+ )
+}
+
/// A card that opens to show `children` (state kept per `key`).
fn expander(key: &'static str, p: &Palette, icon: L, title: &str, desc: Option<&str>, control: Option<AnyElement>, children: impl FnOnce() -> Vec<AnyElement>, cx: &mut App) -> AnyElement {
let open = ui(cx).open.contains(key);
@@ -3875,6 +3983,7 @@ fn advanced(p: &Palette, s: &Settings, cx: &mut App) -> Vec<AnyElement> {
Some(t!("Kopyalama, başka sürücüye taşıma ve kalıcı silme kendi paralel motorumuzla. Kapalıyken her şey Windows'un motoruyla yapılır.")),
sw("fast-ops", p, s.fast_file_ops, |s, v| s.fast_file_ops = v),
),
+ disk_kinds(p, s, cx),
card(
p,
L::Trash,
diff --git a/crates/rf-app/src/status_center.rs b/crates/rf-app/src/status_center.rs
index 62ceb715..a6f0a226 100644
--- a/crates/rf-app/src/status_center.rs
+++ b/crates/rf-app/src/status_center.rs
@@ -1025,6 +1025,7 @@ fn transfer_inner(
let s = cx.global::<crate::settings::Settings>();
let (fast, verify, limit) = (s.fast_file_ops, s.copy_verify.engine(), u64::from(s.copy_speed_limit) << 20);
rf_win::fastcopy::DROP_WSL_ZONE.store(s.wsl_drop_zone, std::sync::atomic::Ordering::Relaxed);
+ rf_win::fastcopy::set_disk_overrides(s.copy_disk_kinds.iter().map(|(drive, kind)| (drive.clone(), *kind)).collect());
let arrived = Arc::new(std::sync::Mutex::new(Vec::<std::path::PathBuf>::new()));
let landed = arrived.clone();
let top = dest.clone();
diff --git a/crates/rf-win/src/drives.rs b/crates/rf-win/src/drives.rs
index 9eeda518..b9b611b9 100644
--- a/crates/rf-win/src/drives.rs
+++ b/crates/rf-win/src/drives.rs
@@ -442,6 +442,69 @@ impl DiskInfo {
}
}
+/// The kind of disk a path is on, as the copy engine sizes its work for it: how many files it copies at once.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
+pub enum DiskKind {
+ /// A spinning disk (also in a USB enclosure that doesn't say what it holds): one file at a time.
+ Hdd,
+ /// An SSD on SATA (or another bus that says it has no seek penalty).
+ SataSsd,
+ /// An NVMe SSD with DRAM of its own.
+ NvmeSsd,
+ /// An NVMe SSD that borrows the PC's memory (Host Memory Buffer) instead of having DRAM.
+ DramlessSsd,
+ /// Removable media: a USB stick, a memory card.
+ UsbStick,
+ /// A network share or a mapped network drive.
+ Network,
+ /// Windows did not say.
+ Unknown,
+}
+
+impl DiskKind {
+ /// The kinds a person can choose for a drive (Settings › Advanced), in the order they are offered.
+ pub const CHOICES: [DiskKind; 6] = [DiskKind::Hdd, DiskKind::SataSsd, DiskKind::NvmeSsd, DiskKind::DramlessSsd, DiskKind::UsbStick, DiskKind::Network];
+}
+
+/// What kind of disk `path` is on, from what Windows reports (no administrator rights).
+pub fn disk_kind(path: &std::path::Path) -> DiskKind {
+ if is_network_path(path) || crate::localized::is_network(path) {
+ return DiskKind::Network;
+ }
+ kind_from(&disk_info(path))
+}
+
+/// The kind a [`DiskInfo`] stands for. A USB enclosure seldom passes a disk's seek penalty on: unknown there means a spinning disk.
+pub fn kind_from(i: &DiskInfo) -> DiskKind {
+ match (i.seek_penalty, i.bus, i.removable) {
+ (Some(true), _, _) => DiskKind::Hdd,
+ (_, _, true) => DiskKind::UsbStick,
+ (None, Some(Bus::Usb), _) => DiskKind::Hdd,
+ (_, Some(Bus::Nvme), _) if i.dramless() == Some(true) => DiskKind::DramlessSsd,
+ (_, Some(Bus::Nvme), _) => DiskKind::NvmeSsd,
+ (Some(false), _, _) => DiskKind::SataSsd,
+ _ => DiskKind::Unknown,
+ }
+}
+
+#[cfg(test)]
+mod disk_kind_tests {
+ use super::{Bus, DiskInfo, DiskKind, kind_from};
+
+ #[test]
+ fn what_windows_says_becomes_a_kind() {
+ let d = |seek, bus, removable, hmb| DiskInfo { seek_penalty: seek, bus, removable, host_memory_buffer_kib: hmb, model: None };
+ assert_eq!(kind_from(&d(Some(true), Some(Bus::Sata), false, None)), DiskKind::Hdd);
+ assert_eq!(kind_from(&d(None, Some(Bus::Usb), false, None)), DiskKind::Hdd, "a USB enclosure that doesn't say");
+ assert_eq!(kind_from(&d(None, Some(Bus::Usb), true, None)), DiskKind::UsbStick);
+ assert_eq!(kind_from(&d(Some(false), Some(Bus::Nvme), false, Some((0, 0)))), DiskKind::NvmeSsd);
+ assert_eq!(kind_from(&d(Some(false), Some(Bus::Nvme), false, Some((65536, 3292)))), DiskKind::DramlessSsd);
+ assert_eq!(kind_from(&d(Some(false), Some(Bus::Sata), false, None)), DiskKind::SataSsd);
+ assert_eq!(kind_from(&d(Some(false), Some(Bus::Usb), false, None)), DiskKind::SataSsd, "a USB SSD that says so");
+ assert_eq!(kind_from(&d(None, None, false, None)), DiskKind::Unknown);
+ }
+}
+
/// One `IOCTL_STORAGE_QUERY_PROPERTY` on the volume of drive letter `path` (opened with no access rights: a property query needs
/// none), `input` in, the bytes Windows wrote out.
fn storage_query(path: &std::path::Path, input: &[u8], out_len: usize) -> Option<Vec<u8>> {
diff --git a/crates/rf-win/src/fastcopy.rs b/crates/rf-win/src/fastcopy.rs
index 6e4dc495..fd5e56cf 100644
--- a/crates/rf-win/src/fastcopy.rs
+++ b/crates/rf-win/src/fastcopy.rs
@@ -1265,6 +1265,35 @@ fn same_volume(a: &Path, b: &Path) -> bool {
root(a).is_some() && root(a) == root(b)
}
+/// The kinds chosen by hand for drives (Settings › Advanced), by volume key ("E:"): they win over what Windows reports.
+static DISK_OVERRIDES: std::sync::RwLock<Vec<(String, crate::drives::DiskKind)>> = std::sync::RwLock::new(Vec::new());
+
+/// Sets the hand-chosen disk kinds (the app, before each transfer).
+pub fn set_disk_overrides(list: Vec<(String, crate::drives::DiskKind)>) {
+ *DISK_OVERRIDES.write().unwrap_or_else(|e| e.into_inner()) = list;
+}
+
+/// The kind of disk the engine sizes its work for at `p`: the one chosen by hand, or what Windows reports.
+pub fn kind_for(p: &Path) -> crate::drives::DiskKind {
+ let key = volume_key(p);
+ let chosen = DISK_OVERRIDES.read().unwrap_or_else(|e| e.into_inner()).iter().find(|(k, _)| k.eq_ignore_ascii_case(&key)).map(|(_, kind)| *kind);
+ chosen.unwrap_or_else(|| crate::drives::disk_kind(p))
+}
+
+/// How many files at once on a kind of disk, with `cores` processor threads. A spinning disk takes one (two make its head jump
+/// between them); removable media, network shares and unknown disks two; a SATA SSD up to 8; an NVMe SSD up to 16. A DRAM-less NVMe
+/// drive takes as many as one with DRAM: measured with 10,000 small files on one (WD Blue SN5000), 16 at once was fastest (4.1 s,
+/// 8 at once 5.7 s, 4 at once 9.5 s).
+pub fn threads_for_kind(kind: crate::drives::DiskKind, cores: usize) -> usize {
+ use crate::drives::DiskKind::*;
+ match kind {
+ Hdd => 1,
+ UsbStick | Network | Unknown => 2,
+ SataSsd => cores.clamp(4, 8),
+ NvmeSsd | DramlessSsd => cores.clamp(4, 16),
+ }
+}
+
/// Parallel copies pay off on SSDs. A spinning disk on either side copies ONE file at a time: two at once already make its head
/// jump between them, and the copy turns from sequential into random reads (issue 679: an HDD and an HDD-backed NAS were much slower
/// than Explorer). So does a USB disk that does not say what it is (most likely a spinning one in an enclosure). Network shares
@@ -1272,25 +1301,17 @@ fn same_volume(a: &Path, b: &Path) -> bool {
fn threads_for(sources: &[PathBuf], dest: &Path) -> usize {
let cores = std::thread::available_parallelism().map_or(4, |n| n.get());
let paths = sources.iter().map(PathBuf::as_path).chain(std::iter::once(dest));
- let mut slow = false;
- // once per drive or share (5,000 files selected in one folder asked the same disk 5,000
- // times, each a volume open and a query, before the first byte)
+ // the fewest any side allows; once per drive or share (5,000 files selected in one folder asked the same disk 5,000 times,
+ // each a volume open and a query, before the first byte)
+ let mut most = cores.clamp(4, 16);
let mut seen = std::collections::HashSet::new();
for p in paths {
if !seen.insert(volume_key(p)) {
continue;
}
- match crate::drives::seek_penalty(p) {
- Some(true) => return 1,
- Some(false) => {}
- // A USB enclosure seldom passes the disk's answer on: there it is most likely a spinning disk, one file at a time (a USB
- // HDD fell from MB/s to kB/s with two at once, Discord 2026-12-02; a USB stick says "removable" and keeps two)
- None if !crate::drives::is_removable(p) && crate::drives::disk_info(p).bus == Some(crate::drives::Bus::Usb) => return 1,
- None => slow = true,
- }
- slow |= crate::drives::is_removable(p);
+ most = most.min(threads_for_kind(kind_for(p), cores));
}
- if slow { 2 } else { cores.clamp(4, 16) }
+ most
}
/// The drive (`C:`) or share (`\\server\share`) a path is on, to ask about each once.
@@ -1335,6 +1356,21 @@ mod tests {
std::fs::remove_file(&src).unwrap();
let _ = std::fs::remove_dir_all(&dir);
}
+ #[test]
+ fn each_kind_of_disk_gets_its_number_of_files_at_once() {
+ use crate::drives::DiskKind::*;
+ assert_eq!(super::threads_for_kind(Hdd, 32), 1);
+ assert_eq!(super::threads_for_kind(UsbStick, 32), 2);
+ assert_eq!(super::threads_for_kind(Network, 32), 2);
+ assert_eq!(super::threads_for_kind(SataSsd, 32), 8);
+ assert_eq!(super::threads_for_kind(NvmeSsd, 32), 16);
+ assert_eq!(super::threads_for_kind(DramlessSsd, 2), 4);
+ // a kind chosen by hand wins over what Windows says
+ super::set_disk_overrides(vec![("Q:".into(), Hdd)]);
+ assert_eq!(super::kind_for(std::path::Path::new(r"q:\x\y")), Hdd);
+ super::set_disk_overrides(Vec::new());
+ }
+
#[test]
fn volume_keys_group_by_drive_and_share() {
use super::volume_key;