gpt4 book ai didi

haskell webframeworks 速度,GHCi 与编译

转载 作者:行者123 更新时间:2023-12-01 01:48:40 26 4
gpt4 key购买 nike

今天我在我的本地机器上做了很少的基准测试来比较不同 Haskell Web 框架的纯文本速度,我注意到一些奇怪的事情。与编译版本相比,我测试过的几乎所有框架在从 GHCi 运行时都表现得更好。这是我的结果

+------------------------------------
|framework| GHCi rpm | compiled rpm
+---------+------------+-------------
|snap | 8000 | 150
+---------+------------+-------------
|yesod | 6000 | 2500
+---------+------------+-------------
|scotty | 22000 | 9500
+---------+------------+-------------
|servant | 17000 | 8500
+---------+------------+-------------
|spock | 3300 | 2700
+---------+------------+-------------

我知道这些数字并没有反射(reflect)这些框架的速度,因为它们没有得到很好的调整或优化,但我的问题是为什么这些框架从 GHCi 启动时表现更好。难道我做错了什么 ?

为了构建它们,我只需运行 stack build

最佳答案

这是 Harendra Kumar 最近在此 GHC ticket 中发现的一个问题。 .您可以查看相关ghc-dev mailing list在这里讨论。请参阅来自 Harendra 的特定观察:

While trying to come up with a minimal example I discovered one more puzzling thing. runghc is fastest, ghc is slower, ghc with optimization is slowest. This is completely reverse of the expected order.



如果可能的话,我建议您提出一个最低限度的基准,并使用您的存储库更新 ghc 票证。

关于haskell webframeworks 速度,GHCi 与编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46296919/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com