[commit: ghc] master: Replace hashing function for string keys implementation with xxhash (542f89f)

git at git.haskell.org git at git.haskell.org
Tue Sep 5 11:22:26 UTC 2017


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

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

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

commit 542f89ff23e4deb66debca0b5de3ac3047befb28
Author: Tamar Christina <tamar at zhox.com>
Date:   Mon Sep 4 08:02:15 2017 -0400

    Replace hashing function for string keys implementation with xxhash
    
    When doing profiling on startup time of ghci on Windows, both cold and
    startup loading static LLVM libs, the profiler is showing a glaring red
    spot on the division operation of the the hashStr function.
    
    In fact profiling shows 14% of the time is spent hashing the keys.
    
    So I am replacing the hash function with xxHash which is a very fast
    non-crypto hash. It's faster than MurMurHash which node etc use.
    
    It also passes SMHasher. I can provide if required the collected raw
    data.  But from analysis done on the keys, xxHash does not introduce
    more collisions than before, the amount splits seem about the same and
    the distributions among the buckets are slightly more uniform than
    before.
    
    However the runtime dropped enough to remove the function completely
    from the profiler's report.
    
    There's also a noticeable improvement in responsiveness.
    
    xxHash is BSD licensed and can be found
    https://github.com/Cyan4973/xxHash
    
    Test Plan: ./validate
    
    Reviewers: austin, bgamari, erikd, simonmar
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #13165
    
    Differential Revision: https://phabricator.haskell.org/D3909


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

542f89ff23e4deb66debca0b5de3ac3047befb28
 rts/Hash.c   |  17 +-
 rts/ghc.mk   |   2 +
 rts/xxhash.c | 888 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 rts/xxhash.h | 293 ++++++++++++++++++++
 4 files changed, 1190 insertions(+), 10 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 542f89ff23e4deb66debca0b5de3ac3047befb28


More information about the ghc-commits mailing list