【发布时间】:2021-09-30 07:13:21
【问题描述】:
我已经在 MinGW 上的 Windows 10 上安装了 gfortran(我不记得是如何安装的,它是一些现成的包)。我在文件 helloworld.f90
program helloworld
print *,'Hello World'
end program helloworld
并在命令提示符中编译它
gfortran helloworld.f90 -o hello
我正在测试 ptime 需要多长时间
C:\fortran tests>ptime hello
=== hello ===
Hello World
Execution time: 23.703 s
C:\fortran tests>ptime hello
=== hello ===
Hello World
Execution time: 1.225 s
C:\fortran tests>ptime hello
=== hello ===
Hello World
Execution time: 1.227 s
我在没有ptime 的情况下测试了它,手动使用秒表,得到了相似的时间,所以我认为ptime 不会导致这种情况。什么可能导致这个极其缓慢的第一次运行 23 秒?为什么下次会更快?而且我认为超过 1s 仍然非常缓慢。我应该查找哪些设置以及如何查找?我在 SOF 中找不到类似的东西。另外,在我的 VirtualBox Ubuntu 上不会出现这个问题,只有在 Windows 上才会出现。
【问题讨论】:
-
病毒扫描程序和 Windows 缓存可执行文件 / dll 的 / 路径等怎么样?您是否尝试过使用小型 C 程序?
-
我的病毒扫描程序搞砸了(见下文),使用 C 时甚至比使用 Fortran 更糟糕:病毒扫描程序自动删除了我的 .exe 文件并警告可疑/有害文件!
标签: windows performance mingw gfortran