[GHC] #7418: Writing to stderr is 7x slower than writing to stdout
GHC
cvs-ghc at haskell.org
Thu Nov 15 17:11:51 CET 2012
#7418: Writing to stderr is 7x slower than writing to stdout
------------------------------------+---------------------------------------
Reporter: SimonHengel | Owner:
Type: bug | Status: new
Priority: normal | Component: Runtime System
Version: 7.6.1 | Keywords:
Os: Linux | Architecture: x86_64 (amd64)
Failure: Runtime performance bug | Blockedby:
Blocking: | Related:
------------------------------------+---------------------------------------
For some reason printing to stderr is significantly slower than printing
to stdout.
I came across this because I realized that simple !QuickCheck properties
are unnecessarily slow. !QuickCheck writes a lot of output to stderr,
overriding old output with {{{\b}}}.
Here are some stats:
'''GHC 7.6.1 / xterm / stdout:'''
{{{
main = sequence_ . replicate 10000 $ hPutStr stdout "foobarbaz" >> hFlush
stdout
}}}
{{{
$ ghc main.hs && time ./main
...
real 0m0.070s
user 0m0.016s
sys 0m0.032s
}}}
'''GHC 7.6.1 / xterm / stderr:'''
{{{
main = sequence_ . replicate 10000 $ hPutStr stderr "foobarbaz" >> hFlush
stderr
}}}
{{{
$ ghc main.hs && time ./main
...
real 0m0.538s
user 0m0.112s
sys 0m0.228s
}}}
If I do the same thing in C, then there is no performance difference.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7418>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list