简体   繁体   English

编译时GHC混乱

[英]GHC clutter while compilation

GHC 7.0.3 (ubuntu repoes) produces during compilation warnings of kind GHC 7.0.3(ubuntu repoes)在编译期间产生类型警告

SpecConstr
    Function `$j_se6a{v} [lid]'
      has one call pattern, but the limit is 0
    Use -fspec-constr-count=n to set the bound
    Use -dppr-debug to see specialisations

I've made my own datatype, when I make it strict there are these warnings, when it is lazy, there are no. 我已经制作了自己的数据类型,当我严格要求时会有这些警告,当它是懒惰的时候,没有。 Though I've tested both versions run equally fast, so probably strictness is excessive here. 虽然我测试过两个版本同样快速运行,但这里的严格程度可能过高。 Anyway are these warnings serious? 无论如何这些警告严重吗?

These warnings can be safely ignored; 可以安全地忽略这些警告; they are always produced in GHC 7.0 because of internal details — basically, they're not real warnings, just debug output. 由于内部细节,它们总是在GHC 7.0中生成 - 基本上,它们不是真正的警告,只是调试输出。

However, you can turn them off using -dno-debug-output , according to this GHC bug report . 但是,根据此GHC错误报告 ,您可以使用-dno-debug-output关闭它们。

You should no longer see them if you upgrade to GHC 7.2. 如果升级到GHC 7.2,则不应再看到它们。

These messages (technically not even warnings) indicate that GHC could do further optimisations (which might or might not result in improved performance), but due to the limit placed on constructor specialisation doesn't. 这些消息(技术上甚至不是警告)表明GHC可以进行进一步的优化(可能会或可能不会导致性能提高),但是由于构造函数专门化的限制没有。 You could also get rid of them by passing -fspec-constr-count=n with a sufficiently large n (default is 3) or -fno-spec-constr-count to the compiler. 您也可以通过将-fspec-constr-count=n与足够大的n (默认值为3)或-fno-spec-constr-count传递给编译器来消除它们。 The result would be larger code (more specialisations), which could be faster, equally fast, or in unfortunate cases slower. 结果将是更大的代码(更多的特化),这可能更快,同样快,或者在不幸的情况下更慢。 If performance is critical, you should try and compare. 如果性能至关重要,您应该尝试进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM