f#编译太慢 [英] f# compiling too slow

查看:94
本文介绍了f#编译太慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是f#的新手.我下载了Visual Studio 2010 Shell和F#ctp,并使用以下代码编写了一个小的hello world脚本

I'm new to f#. I downloaded the Visual Studio 2010 shell and the F# ctp and wrote a small hello world script with the following code

printfn "Hello World"
let _ = System.Console.ReadLine()

编译大约需要13到15秒,与运行类似的C#脚本(大约需要2秒钟)相比,这是非常慢的.我希望F#脚本能更快地编译,以便减少开发(即实验)时间,而我不在乎运行时的性能.

This takes around 13 to 15 seconds to compile which is very slow compared to running a similar C# script(which takes around 2 secs). I'd like the F# script to compile faster so that my development(i.e. experimentation) time would be reduced, I don't care for the runtime performance.

有什么方法可以使F#脚本的编译速度更快,也许可以打开/关闭Visual Studio中的某些Build设置或类似的东西?

Is there any way to make the F# script compile faster, maybe turn on/off some Build settings in Visual Studio or something like that?

仅供参考,如果有帮助,我正在使用4岁的奔腾4、1.5 GB RAM计算机.

FYI, I'm using a 4 year old pentium 4, 1.5 gb RAM machine, if that helps.

推荐答案

我不知道Pentium 4编译"hello world"程序的速度有多快,但是15秒钟让我感到非常慢.我曾经在VS 2010 Beta中遇到过类似的速度问题,结果却是Visual Studio和F#编译器尚未正确进行NGENed.

I have no idea how fast a Pentium 4 should compile that "hello world" program, but 15 seconds strikes me as pretty slow. I once had similar speed problems with a VS 2010 Beta and the problem turned out to be that Visual Studio and the F# compiler weren't yet properly NGENed.

通常,Visual Studio安装应确保所有内容都经过NGENed处理,但也许出了点问题.您可以在具有管理员权限的控制台窗口中使用以下命令检查F#编译器是否已被NGENed:

Normally, the Visual Studio install should make sure that everything gets NGENed, but maybe something went wrong. You can check if the F# compiler was NGENed with the following command in a console window with admin rights:

cd "C:\Program Files\FSharp-2.0.0.0\bin"
c:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe display fsc.exe

如果结果表明fsc.exe的本机映像仍在挂起,则可以使用以下命令强制编译:

If the result of that shows that the native image of fsc.exe is still pending, you could force the compilation with:

c:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe executeQueuedItems

注意:我不确定您使用的是哪个版本的F#编译器.完整安装VS2010所使用的一个是C:\Program Files\Microsoft F#\v4.0(或在64位计算机上的C:\Program Files (x86)\Microsoft F#\v4.0)中的一个.因此,如果使用该文件夹,则必须cd进入该文件夹,而不是C:\Program Files\FSharp-2.0.0.0\bin文件夹.

Note: I'm not sure which version of the F# compiler you're using exactly. The one used by the full install of VS2010 is the one in C:\Program Files\Microsoft F#\v4.0 (or C:\Program Files (x86)\Microsoft F#\v4.0 on 64-bit machines). So, if you use that one, you have to cd into that folder instead of the C:\Program Files\FSharp-2.0.0.0\bin folder.

这篇关于f#编译太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆