GHCi is faster than compiled code
A stackoverflow user Milad Zahedi reports that running his code in GHCi is 50x faster than compiling it and running the compiled binary.
Today I did little benchmarking on my local machine to compare plain text speed of different Haskell web frameworks, and I noticed something strange. Almost all the frameworks that I tested, performed better when they were run from GHCi compared to compiled version. here are my results
+------------------------------------
|framework| GHCi rpm | compiled rpm
+---------+------------+-------------
|snap | 8000 | 150
+---------+------------+-------------
|yesod | 6000 | 2500
+---------+------------+-------------
|scotty | 22000 | 9500
+---------+------------+-------------
|servant | 17000 | 8500
+---------+------------+-------------
|spock | 3300 | 2700
+---------+------------+-------------
I know that these numbers do not reflect on these frameworks speed, since they are not well tuned or optimized, but my question is why are these frameworks performing better when launched from GHCi. Am I doing something wrong ?
in order to build them I simply run stack build
The benchmarks are from https://github.com/miladz68/haskell-webframework-comparison
This ticket is to verify and investigate these claims.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |