[commit: ghc] wip/T5642: Refactor derived Generic instances to reduce allocations (5bfbdf4)

git at git.haskell.org git at git.haskell.org
Sun Jun 5 18:23:06 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T5642
Link       : http://ghc.haskell.org/trac/ghc/changeset/5bfbdf4ce91a66a79d86a0a89e8f9077cc9b2de6/ghc

>---------------------------------------------------------------

commit 5bfbdf4ce91a66a79d86a0a89e8f9077cc9b2de6
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Sun Jun 5 14:24:27 2016 -0400

    Refactor derived Generic instances to reduce allocations
    
    Summary:
    Previously, derived implementations of `to`/`from` in `Generic`
    instances were wastefully putting extra `M1`s in every case, which led
    to an O(n) increase in the number of coercions, resulting in a slowdown
    during the typechecker phase.
    
    This factors out the common `M1` in every case of a `to`/`from`
    definition so that the typechecker has far fewer coercions to deal with.
    For a datatype with 300 constructors, this change has been observed to
    save almost 3 seconds of compilation time.
    
    This is one step towards coming up with a solution for #5642.
    
    Test Plan: ./validate
    
    Reviewers: simonpj, hvr, bgamari, austin
    
    Subscribers: basvandijk, carter, thomie, osa1
    
    Differential Revision: https://phabricator.haskell.org/D2304
    
    GHC Trac Issues: #5642


>---------------------------------------------------------------

5bfbdf4ce91a66a79d86a0a89e8f9077cc9b2de6
 compiler/typecheck/TcGenGenerics.hs                |  83 ++++-
 testsuite/tests/generics/GenDerivOutput.stderr     | 144 ++++----
 testsuite/tests/generics/GenDerivOutput1_0.stderr  |  35 +-
 testsuite/tests/generics/GenDerivOutput1_1.stderr  | 264 +++++++-------
 .../tests/generics/T10604/T10604_deriving.stderr   | 253 +++++++------
 testsuite/tests/perf/compiler/T5642.hs             | 402 +++++++++++----------
 6 files changed, 646 insertions(+), 535 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 5bfbdf4ce91a66a79d86a0a89e8f9077cc9b2de6


More information about the ghc-commits mailing list