gpt4 book ai didi

cygwin 文件打开速度慢

转载 作者:行者123 更新时间:2023-12-04 12:14:38 24 4
gpt4 key购买 nike

我的应用程序使用 fopen 打开大量文件。在 linux 中打开和读取数千个文件甚至不需要一秒钟;在 cygwin 中需要超过 5 秒。

我认为这是因为 cygwin dll 中的路径转换功能。 “打开”功能要快一些。如果我使用 -mno-cygwin 它会变得非常快但我不能使用它。

有没有一种简单的方法可以让 cygwin dll 只打开文件;没有任何 linux-windows 转换?

最佳答案

这取决于系统在 Cygwin 环境中的安装方式。

$ mount
C:/cygwin/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
D: on /cygdrive/d type iso9660 (binary,posix=0,user,noumount,auto)

安装选项“二进制”使其如此 CRLF <-> LF不会对从卷读取的文件执行转换。这是默认设置。

您可以执行以下操作来加速 Cygwin 提示:
  • 将以下行添加到您的 ~/.bashrc :

  • # eliminate long Windows pathnames from the PATH
    export PATH='/bin:/usr/bin:/usr/local/bin'

    # check the hash before searching the PATH directories
    shopt -s checkhash

    # do not search the path when .-sourcing a file
    shopt -u sourcepath
  • 断开网络驱动器。
  • 禁用您的防病毒软件,或以其他方式从扫描中排除 Cygwin 的文件夹。

  • 彻底的防病毒程序会在文件被程序打开时扫描恶意软件,这意味着如果您的脚本打开数千个文件,它就会超时工作。
  • 使用选项 --cache-file="$HOME/.config.cache"运行自动工具时 configure脚本。

  • 这将创建一个文件,其中包含预先记录的配置发现,其中大部分可在软件构建之间使用。 (这在使用 Linux 时也是一个好主意)。

    由于 shell 似乎是 Cygwin 系统的瓶颈,依赖于启动大量进程的巨大脚本将永远运行,这将减少它需要启动的进程数。
  • 设置 Cygwin 的 sshd并停止使用 Windows 命令提示符转而使用 PuTTY。

  • PuTTY 对更改屏幕上的文本有更好的响应,因为它是为 *NIX 的更成熟的 CLI 界面而构建的。

    关于cygwin 文件打开速度慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2537813/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com