Skip to content

GHC 8.0.* is slow when run on Windows 10 Ubuntu subsystem

I have tried both 8.0.1 and 8.0.2 versions of GHC. 7.10.3 runs just fine. Installation process is also much faster for 7.10.3, later versions have taken around 4 hours to be installed.

Programs compiled with slow GHC are also slow. Sample program:

main = putStrLn "Hello, world!"

GHC is installed with Stack.

Windows version is 1607 build 15031.0 I believe this could be a bug in implementation of Ubuntu subsystem, but I'm not quite sure what part of it is failing.

$ time stack ghc -- -e 'putStrLn ""'

real    2m28.240s
user    0m0.375s
sys     3m30.078s

$ time stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2

real    1m45.533s
user    0m0.125s
sys     2m46.516s

time stack ghc --compiler ghc-8.0.1 -- --version
The Glorious Glasgow Haskell Compilation System, version 8.0.1

real    2m54.764s
user    0m0.234s
sys     3m58.422s
$ time ghc -e 'putStrLn ""'

real    0m0.872s
user    0m0.109s
sys     0m0.125s

$ time ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3

real    0m0.072s
user    0m0.000s
sys     0m0.031s

time stack ghc --compiler ghc-7.10.3 -- -e 'putStrLn ""'

real    0m0.876s
user    0m0.234s
sys     0m0.688s

time stack ghc --compiler ghc-7.10.3 -- --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3

real    0m0.832s
user    0m0.109s
sys     0m0.813s
$ echo 'main = putStrLn "Hello, world!"' > test.hs
$ time stack ghc --compiler ghc-8.0.2 -- test
[1 of 1] Compiling Main             ( test.hs, test.o )
Linking test ...

real    3m56.582s
user    0m0.609s
sys     5m8.125s

$ time ./test
Hello, world!

real    0m27.540s
user    0m0.000s
sys     0m27.297s
$ echo 'main = putStrLn "Hello, world!"' > test.hs
$ time stack ghc --compiler ghc-7.10.3 -- test
[1 of 1] Compiling Main             ( test.hs, test.o )
Linking test ...

real    0m2.222s
user    0m0.406s
sys     0m1.406s

$ time ./test
Hello, world!

real    0m0.030s
user    0m0.000s
sys     0m0.031s

Part of Stack output with timings:

$ stack ghc --verbose -- -e 'putStrLn "Hello, world!"'
Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 (4395 commits) x86_64 hpack-0.15.0
...
2017-02-19 21:13:05.756085: [debug] No project config file found, using defaults.
2017-02-19 21:13:05.759402: [debug] Run from outside a project, using implicit global project config
2017-02-19 21:13:05.761724: [debug] Using resolver: lts-8.0 from implicit global project's config file: /home/sukhmel/.stack/global-project/stack.yaml
...
2017-02-19 21:13:05.788855: [debug] Run process: /sbin/ldconfig -p
2017-02-19 21:13:05.816489: [debug] Process finished in 26ms: /sbin/ldconfig -p
2017-02-19 21:13:05.820648: [debug] Run process: /usr/bin/gcc -v
2017-02-19 21:13:05.844975: [debug] Process finished in 23ms: /usr/bin/gcc -v
...
2017-02-19 21:13:05.854997: [debug] Using standard GHC build
2017-02-19 21:13:05.856774: [debug] Getting global package database location
...
2017-02-19 21:13:05.867711: [debug] Run process: /home/sukhmel/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
2017-02-19 21:13:05.888957: [debug] Run process: /home/sukhmel/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --numeric-version
2017-02-19 21:13:05.919968: [debug] Run process: /home/sukhmel/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
2017-02-19 21:13:38.605653: [debug] Process finished in 32736ms: /home/sukhmel/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
2017-02-19 21:14:11.930034: [debug] Process finished in 32792ms: /home/sukhmel/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
2017-02-19 21:14:11.931071: [debug] Process finished in 32831ms: /home/sukhmel/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --numeric-version
...
2017-02-19 21:14:11.939817: [debug] Run process: /home/sukhmel/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc -e "putStrLn \"Hello, world!\""
Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information