Haskell:在堆栈项目上调试长编译时间 [英] Haskell: Debugging Long Compilation Times on Stack Projects

查看:187
本文介绍了Haskell:在堆栈项目上调试长编译时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用Stack来构建一个项目,总计约80个模块和13,000行代码。目前,对于我的类型文件的轻微更改,编译需要大约3分钟,这是不可接受的 - 它阻止我通过堆栈ghci快速测试我的代码。它也大大减缓了一些事情:例如,与同行进行结对编程或咨询专家。

我想弄清楚为什么要进行编译这么长时间,我能做些什么来加速它。有什么方法可以编辑编译时间?



另外,如何判断它是堆栈还是ghc很慢?



我知道关于设置-O0,尽管这似乎并没有帮助编译时间。我也知道TemplateHaskell和Typeclass决议可能需要一段时间 - 有什么办法可以得到更好的决议,这些正在采取多久?



注意:我看过加速GHC的编译,但那是从2013年开始的,目前hdevtools的确如果这个问题仍然相关,你可以试试这个:

$ b

解决方案


$ b

  stack ghci --fast --no-build --ghc-options = -  fbyte-code

使用此功能,IIRC使用 stack ghci 获得了最快的结果。



如果这样做没有足够的帮助,可以查看 - ghc-options = - dshow-passes的方向。我自己也正在朝这个方向努力加速构建/ ghci-reload。


I'm currently using Stack to build a project, which totals about 80 modules and 13,000 lines of code. Currently, compilation takes about 3 minutes for a minor change in my types files, which is unacceptable -- it prevents me from rapidly testing my code via stack ghci. It also significantly slows down a number of things: for instance, pair programming with peers or consulting with experts.

I would like to be able to figure out why compilation is taking so long, and what I can do to speed it up. Is there some way to profile compilation times?

Additionally, how can I tell whether it is stack or ghc that is slow?

I know about setting -O0, though this does not seem to help compilation times. I also know that TemplateHaskell and Typeclass Resolution can take a while -- is there any way I can get better resolution on how long these are taking?

Note: i have seen Speed up compilation in GHC, but that was from 2013, and hdevtools currently does not work on my setup.

解决方案

In case this question is still relevant, you could try this:

stack ghci --fast --no-build --ghc-options="-fbyte-code"

IIRC using this got me the quickest results with stack ghci.

If this doesn't help enough, you could look in the direction of --ghc-options="-dshow-passes". I myself am also looking in this direction currently to try to speed up a build/ghci-reload.

这篇关于Haskell:在堆栈项目上调试长编译时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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