[commit: ghc] master: Optimize linker by minimizing calls to tryGCC to avoid fork/exec overhead. (8d64745)
git at git.haskell.org
git at git.haskell.org
Tue Oct 3 21:56:13 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/8d647450655713e035091349d5163a1a28be18f4/ghc
>---------------------------------------------------------------
commit 8d647450655713e035091349d5163a1a28be18f4
Author: Tamar Christina <tamar at zhox.com>
Date: Tue Oct 3 14:55:28 2017 -0400
Optimize linker by minimizing calls to tryGCC to avoid fork/exec overhead.
On Windows process creations are fairly expensive. As such calling them in
what's essentially a hot loop is also fairly expensive.
Each time we make a call to `tryGCC` the following fork/exec/wait happen
```
gcc -> realgcc -> cc1
```
This is very problematic, because according to the profiler about 20% of the
time is spent on just process creation and spin time.
The goal of the patch is to mitigate this by asking GCC once for it's search
directories, caching these (because it's very hard to change these at all
after the process started since GCC's base dirs don't change unless with
extra supplied `-B` flags.).
We also do the same for the `findSysDll` function, since this computes
the search path every time by registery accesses etc.
These changes and D3909 drop GHC on Windows startup time from 2-3s to 0.5s.
The remaining issue is a 1.5s wait lock on `CONIN$` which can be addressed
with the new I/O manager code. But this makes GHCi as responsive on Windows as
GHC 7.8 was.
Test Plan: ./validate
Reviewers: austin, hvr, bgamari, erikd
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3910
>---------------------------------------------------------------
8d647450655713e035091349d5163a1a28be18f4
compiler/ghci/Linker.hs | 125 ++++++++++++++++++++++++++++++++-------
docs/users_guide/8.4.1-notes.rst | 10 ++--
2 files changed, 109 insertions(+), 26 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8d647450655713e035091349d5163a1a28be18f4
More information about the ghc-commits
mailing list