Skip to content
  • Cheng Shao's avatar
    87d8f6c2
    hadrian: replace default -H32m/-H64m with -O64M to improve mutator productivity · 87d8f6c2
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    Most hadrian build flavours pass `-H32m`/`-H64m` to GHC as
    conventional wisdom to improve mutator productivity and reduce GC
    overhead. They were inherited from the legacy Make build system, and
    there used to be make flags to instrument a build process with
    `-Rghc-timing` option to collect GC stats of each GHC run from stderr.
    
    It's time to revisit whether there are better defaults for
    `-H32m`/`-H64m`, and this patch changes it to `-O64M` which indeed
    improves mutator productivity based on real statistics. `-O64M` is
    more aggressive than `-H64m`; it allows the old generation to grow to
    at least 64M before triggering major GC and reduces major GC runs.
    
    The stats of a clean build with `validate` flavour and `-H64m`:
    
    ```
    h64m.log
      matched RTS stat lines: 5499
      sum MUT cpu     : 2400.808 s
      sum GC cpu      : 1378.292 s
      sum MUT elapsed : 2788.253 s
      sum GC elapsed  : 1389.233 s
      GC/MUT cpu ratio     : 0.574 (GC is 57.4% of MUT)
      GC/MUT elapsed ratio : 0.498 (GC is 49.8% of MUT)
      GC fraction of (MUT+GC) cpu     : 36.5%
      GC fraction of (MUT+GC) elapsed : 33.3%
      per-line GC/MUT cpu ratio: median 0.691, p90 1.777
      per-line GC/MUT elapsed ratio: median 0.519, p90 1.081
    ```
    
    The stats of a clean build with `validate` flavour and `-O64M`:
    
    ```
    o64m.log
      matched RTS stat lines: 5499
      sum MUT cpu     : 2377.383 s
      sum GC cpu      : 1127.146 s
      sum MUT elapsed : 2758.857 s
      sum GC elapsed  : 1135.587 s
      GC/MUT cpu ratio     : 0.474 (GC is 47.4% of MUT)
      GC/MUT elapsed ratio : 0.412 (GC is 41.2% of MUT)
      GC fraction of (MUT+GC) cpu     : 32.2%
      GC fraction of (MUT+GC) elapsed : 29.2%
      per-line GC/MUT cpu ratio: median 0.489, p90 1.099
      per-line GC/MUT elapsed ratio: median 0.367, p90 0.806
    ```
    
    Mutator time is roughly in the same ballpark, but GC CPU time has
    reduced by 18.22%, and mutator productivity has increased from 63.5%
    to 67.8%.
    87d8f6c2
    hadrian: replace default -H32m/-H64m with -O64M to improve mutator productivity
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    Most hadrian build flavours pass `-H32m`/`-H64m` to GHC as
    conventional wisdom to improve mutator productivity and reduce GC
    overhead. They were inherited from the legacy Make build system, and
    there used to be make flags to instrument a build process with
    `-Rghc-timing` option to collect GC stats of each GHC run from stderr.
    
    It's time to revisit whether there are better defaults for
    `-H32m`/`-H64m`, and this patch changes it to `-O64M` which indeed
    improves mutator productivity based on real statistics. `-O64M` is
    more aggressive than `-H64m`; it allows the old generation to grow to
    at least 64M before triggering major GC and reduces major GC runs.
    
    The stats of a clean build with `validate` flavour and `-H64m`:
    
    ```
    h64m.log
      matched RTS stat lines: 5499
      sum MUT cpu     : 2400.808 s
      sum GC cpu      : 1378.292 s
      sum MUT elapsed : 2788.253 s
      sum GC elapsed  : 1389.233 s
      GC/MUT cpu ratio     : 0.574 (GC is 57.4% of MUT)
      GC/MUT elapsed ratio : 0.498 (GC is 49.8% of MUT)
      GC fraction of (MUT+GC) cpu     : 36.5%
      GC fraction of (MUT+GC) elapsed : 33.3%
      per-line GC/MUT cpu ratio: median 0.691, p90 1.777
      per-line GC/MUT elapsed ratio: median 0.519, p90 1.081
    ```
    
    The stats of a clean build with `validate` flavour and `-O64M`:
    
    ```
    o64m.log
      matched RTS stat lines: 5499
      sum MUT cpu     : 2377.383 s
      sum GC cpu      : 1127.146 s
      sum MUT elapsed : 2758.857 s
      sum GC elapsed  : 1135.587 s
      GC/MUT cpu ratio     : 0.474 (GC is 47.4% of MUT)
      GC/MUT elapsed ratio : 0.412 (GC is 41.2% of MUT)
      GC fraction of (MUT+GC) cpu     : 32.2%
      GC fraction of (MUT+GC) elapsed : 29.2%
      per-line GC/MUT cpu ratio: median 0.489, p90 1.099
      per-line GC/MUT elapsed ratio: median 0.367, p90 0.806
    ```
    
    Mutator time is roughly in the same ballpark, but GC CPU time has
    reduced by 18.22%, and mutator productivity has increased from 63.5%
    to 67.8%.
Loading