cygwin 文件打开速度慢
我的应用程序使用 fopen 打开很多文件。而在 Linux 中,打开和读取数千个文件甚至不需要一秒钟;在cygwin中需要5秒以上。
我认为这是因为 cygwin dll 中的路径转换函数。 “打开”功能要快一些。如果我使用 -mno-cygwin 它会变得非常快,但我无法使用它。
有没有一种简单的方法可以让 cygwin dll 仅打开文件?没有任何linux-windows转换?
My application uses fopen to open a lot of files. While in linux opening and reading thousand of files doesn't even take a second; in cygwin it takes more than 5 seconds.
I think it is because path conversion functions in cygwin dlls. 'open' function is a bit faster. If I use -mno-cygwin it becomes very fast but I can't use it.
Is there an easy way to make cygwin dlls just open files; without any linux-windows conversion?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于系统在 Cygwin 环境中的安装方式。
挂载选项“binary”使其如此
CRLF
<->不对从卷读取的文件执行LF
转换。这是默认的。您可以采取以下措施来加快 Cygwin 提示的速度:
~/.bashrc
中:断开网络驱动器的连接。
禁用您的防病毒软件,或以其他方式从扫描中排除 Cygwin 的文件夹。
彻底的防病毒程序会在程序打开文件时扫描文件中是否存在恶意软件,这意味着如果您的脚本打开数千个文件,它将超时工作。
configure
脚本时使用选项--cache-file="$HOME/.config.cache"
。这将创建一个保存预先记录的配置发现的文件,其中大部分可在软件构建之间使用。 (使用 Linux 时这也是一个好主意)。
由于 shell 似乎是 Cygwin 系统的瓶颈,因此依赖于启动大量进程的庞大脚本将永远花费时间,这将减少它需要启动的进程数量。
PuTTY 可以更好地响应屏幕上文本的变化,因为它是为更成熟的 *NIX CLI 界面而构建的。
It depends on how the system was mounted in the Cygwin environment.
The mount option "binary" makes it so
CRLF
<->LF
conversions are not performed on files read from the volume. This is default.Some things you can do to speed up a Cygwin prompt are the following:
~/.bashrc
:Disconnect your network drives.
Disable your antivirus, or otherwise exclude Cygwin's folders from its scans.
Thorough antivirus programs scan files for malware as they're opened by programs, and this means it'll be working overtime if your script is opening thousands of files.
--cache-file="$HOME/.config.cache"
when running autotoolsconfigure
scripts.This will create a file that holds prerecorded configure discoveries, most of which are usable between software builds. (This is also a good idea when using Linux).
Since the shell seems to be the bottleneck of the Cygwin system, a huge script that relies on starting a large number of processes will take forever and this will cut down on the number of processes it needs to start.
sshd
and stop using Windows Command Prompt in favor of PuTTY.PuTTY responds better to changing text on the screen, as it was built for the more mature CLI interface of *NIX.