[commit: ghc] master: Fix quadratic behaviour in tidyOccName (c89bd68)

git at git.haskell.org git at git.haskell.org
Fri May 22 14:14:42 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c89bd681d34d3339771ebdde8aa468b1d9ab042b/ghc

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

commit c89bd681d34d3339771ebdde8aa468b1d9ab042b
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri May 22 14:46:51 2015 +0100

    Fix quadratic behaviour in tidyOccName
    
    In the test program from comment:3 of Trac #10370, it turned out
    that 25% of all compile time was going in OccName.tidyOccName!
    
    It was all becuase the algorithm for finding an unused OccName
    had a quadratic case.
    
    This patch fixes it.  THe effect is pretty big:
    
    Before:
    	total time  =       34.30 secs   (34295 ticks @ 1000 us, 1 processor)
    	total alloc = 15,496,011,168 bytes  (excludes profiling overheads)
    
    After
    	total time  =       25.41 secs   (25415 ticks @ 1000 us, 1 processor)
    	total alloc = 11,812,744,816 bytes  (excludes profiling overheads)


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

c89bd681d34d3339771ebdde8aa468b1d9ab042b
 compiler/basicTypes/OccName.hs                     | 57 +++++++++++++++++-----
 compiler/typecheck/TcMType.hs                      |  2 -
 compiler/types/TypeRep.hs                          |  2 +
 .../tests/ghci.debugger/scripts/print027.stdout    |  6 +--
 testsuite/tests/parser/should_fail/T7848.stderr    |  6 +--
 .../tests/simplCore/should_compile/T7360.stderr    | 16 +++---
 6 files changed, 60 insertions(+), 29 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 c89bd681d34d3339771ebdde8aa468b1d9ab042b


More information about the ghc-commits mailing list