C# - 在 USB 上快速创建大文件
当 Xbox 360 主机格式化 1GB USB 设备时,只需 20 秒即可添加 978MB 的数据。我可以看到 USB 上的文件,它们就是那个大小。
当我在Windows中复制相同长度的文件时,需要6分钟。
也许是因为Windows读/写,但360只写?
有没有办法在 USB 上创建这样的大文件并具有这种性能?当然,这些文件可以是空白的。我的申请需要这种写作能力。
我尝试过的大多数 cmd 工具都没有任何明显的性能提升。
When the Xbox 360 console formats a 1gb USB device, it adds 978mb of data to it in just 20 seconds. I can see the files on the USB and they are that size.
When I copy a file of the same length in Windows, it takes 6 minutes.
Maybe it is because Windows reads/writes, but the 360 just writes?
Is there a way to create large files like that on a USB with that kind of performance? The files can be blank, of course. I need this writing performance for my application.
Most of the cmd tools I have tried have not had any noticeable performance gains.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看起来 360 正在为文件分配空间并将一些数据写入文件,但否则会留下文件的其余部分填充最初存在的任何数据(所谓的“垃圾数据”) ”)。当您将相同大小的文件复制到驱动器时,它会写入全部 978MB,这是一个不同的情况,也是它花费更长时间的原因。
It would appear that the 360 is allocating space for the file and writing some data to the file, but is otherwise leaving the rest of the file filled with whatever data was there originally (so-called "garbage data"). When you copy a file of the same size to the drive, it is writing all 978MB of, which is a different scenario and is why it takes so much longer.
360 很可能不会将 978mb 的数据发送到 USB 记忆棒,而是创建一个大小为 978mb 的空文件 - 您的文件需要更长的时间,因为您不是简单地发送几 KB 来更改文件系统信息,而是实际上发送了 978mb 的数据。数据到设备。
您可以使用 fsutil 或 Sysinternals“contig”工具在 Windows 上执行类似的操作(创建固定大小的空文件):请参阅 在windows系统上快速创建大文件? - 试试这个,你会发现它可以花费不到20秒的时间(我猜测360正在发送一些数据,以及为更多数据预留空间)。请注意,其中一个答案显示了如何使用 Windows API 以及 python 脚本来执行相同的操作。
Most likely the 360 is not sending 978mb of data to the usb stick, but is instead creating an empty file of size 978mb - yours takes longer because rather than simply sending a few KB to alter the file system information, you are actually sending 978mb of data to the device.
You can do something similar (create an empty file of fixed size) on windows with fsutil or Sysinternals "contig" tool: See Quickly create large file on a windows system? - try this, and you'll see that it can take much less than 20 seconds (I would guess that the 360 is sending some data, as well as reserving space for more). Note that one of the answers shows how to use the windows API to do the same thing, as well as a python script.
难道360只是在做一些直接的文件系统头操作吗?如果空白文件适合您,也许您可以尝试一下?
Could it be that the 360 is just doing some direct filesystem header manipulation? If a blank file is fine for you maybe you could try that?
这完全取决于 USB 驱动器的吞吐量。您将需要一个高端 USB,如下所示:此列表
It is all dependent on the throughput of the usb drive. You will need a high end usb such as the following: this list