It seems that Haskell's IO is relatively slow.
For example, comparing Haskell with Python
#io.py
import sys
s=sys.stdin.read()
sys.stdout.write(s)
,
-- io.hs
main = do
s <- getContents
putStr s
Their performance (gen.py writes 512k data into stdout):
The Python version:
$ time python gen.py | python io.py > /dev/null
real 0m0.203s
user 0m0.015s
sys 0m0.000s
The Haskell version:
$ time python gen.py | runhaskell io.hs > /dev/null
real 0m0.562s
user 0m0.015s
sys 0m0.000s
It seems that the Haskell one is far lower. Is there any problem with my test? Or is it just the inherent problem of Haskell?
Thanks.