为什么GHC这么大/大? [英] Why is GHC so large/big?

查看:129
本文介绍了为什么GHC这么大/大?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个简单的答案:为什么GHC这么大?


  • OCaml:2MB

  • Python:15MB SBCL:9MB

  • OpenJRE - 26MB

  • GHC:113MB


  • 对如果Haskell是正确的工具,我为什么不应该关心它的大小这个传福音不感兴趣;这是一个技术问题。

    解决方案

    真的有点傻。每个提供GHC的图书馆都提供不少于 4种风格


    • static

    • 动态

    • 个人资料
    • GHCi



    GHCi版本只是在单个 .o 文件中链接在一起的静态版本。其他三个版本都有自己的一组接口文件( .hi 文件)。这些配置文件的版本似乎大约是未打稿版本的两倍(这有点可疑,我应该考虑一下这是为什么)。

    GHC本身就是一个图书馆
    ,所以你得到4份GHC。不仅如此,GHC二进制文件本身是静态链接的,所以这是GHC的5个副本。



    我们最近做了这样的设置,使得GHCi可以使用静态 .a 文件。这将使我们摆脱这些风味之一。从长远来看,我们应该动态链接GHC,但这是一个更大的变化,因为这需要动态链接默认设置 - 与C不同,GHC必须决定是否要动态链接。我们需要做出更多改变(例如在Cabal和包装系统等等)之前,这是非常实用的。


    Is there a simple answer: Why is GHC so big?

    • OCaml: 2MB
    • Python: 15MB
    • SBCL: 9MB
    • OpenJRE - 26MB
    • GHC: 113MB

    Not interested in evangelism of "Why I shouldn't care about the size if Haskell is the right tool"; this is a technical question.

    解决方案

    It's a bit silly really. Every library that comes with GHC is provided in no less than 4 flavours:

    • static
    • dynamic
    • profiled
    • GHCi

    The GHCi version is just the static version linked together in a single .o file. The other three versions all have their own set of interface files (.hi files) too. The profiled versions seem to be about twice the size of the unprofiled versions (which is a bit suspicious, I should look into why that is).

    Remember that GHC itself is a library, so you're getting 4 copies of GHC. Not only that, but the GHC binary itself is statically linked, so that's 5 copies of GHC.

    We recently made it so that GHCi could use the static .a files. That will allow us to get rid of one of these flavours. Longer term, we should dynamically link GHC, but that's a bigger change because that would entail making dynamic linking the default - unlike in C, with GHC you have to decide up front whether you're going to link dynamically or not. And we need more changes (e.g. to Cabal and the package system, amongst other things) before this is really practical.

    这篇关于为什么GHC这么大/大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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