Skip to content
  • Zejun Wu's avatar
    Rewrite FastString table in concurrent hashtable · 5126764b
    Zejun Wu authored and Ben Gamari's avatar Ben Gamari committed
    Summary:
    Reimplement global FastString table using a concurrent hashatable with
    fixed size segments and dynamically growing buckets instead of fixed size
    buckets.
    
    This addresses the problem that `mkFastString` was not linear when the
    total number of entries was large.
    
    Test Plan:
    ./validate
    
    ```
    inplace/bin/ghc-stage2 --interactive -dfaststring-stats < /dev/null
    GHCi, version 8.7.20181005: http://www.haskell.org/ghc/  :? for help
    Prelude> Leaving GHCi.
    FastString stats:
        segments:          256
        buckets:           16384
        entries:           7117
        largest segment:   64
        smallest segment:  64
        longest bucket:    5
        has z-encoding:    0%
    ```
    
    Also comapre the two implementation using
    
    {P187}
    
    The new implementation is on a par with the old version with different
    conbination of parameters and perform better when the number of
    FastString's are large.
    
    {P188}
    
    Reviewers: simonmar, bgamari, niteria
    
    Reviewed By: simonmar, bgamari
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #14854
    
    Differential Revision: https://phabricator.haskell.org/D5211
    5126764b