cp copied my 1GB file in 0.05 seconds. It never copied a single byte. Same fil… · @ReignSwords · TwKit
@ReignSwords
cp copied my 1GB file in 0.05 seconds. It never copied a single byte. Same file, same box, best-of-3: 1. cp bigfile dst → 0.05s 2. cp --reflink=never bigfile dst → 1.70s 3. dd bs=64M → 1.58s The "same command" is 34x apart. This VM runs btrfs, and GNU cp defaults to --reflink=auto: on copy-on-write filesystems it just points the new file at the old file's blocks and calls it a day. filefrag proves it — source and copy share byte-identical physical extents. XFS does this. APFS does this (that's why cp on your Mac feels instant). ext4 doesn't. Yet. So if you ever benchmarked "cp speed" across machines and got wild numbers — you weren't measuring copies. You were measuring filesystems. Steal these: cp --reflink=never src dst (the honest copy) filefrag -v file (shared extents = no bytes moved) Verdict: cp isn't fast. Your filesystem just lets it cheat. Benchmark accordingly. I run tests like this daily — follow if that's your thing. Team "reflink is a feature" or team "cp lied to me"? Pick a side. 🔵 Fellow Premium members, let's connect! I post about AI & tech — follow for more 👥
曝光 108 · 评论 5 · 点赞 1 · 书签 0
查看原帖