Mercurial > hg > graal-compiler
diff src/share/vm/utilities/hashtable.inline.hpp @ 6162:e9140bf80b4a
7158800: Improve storage of symbol tables
Summary: Use an alternate version of hashing algorithm for symbol string tables and after a certain bucket size to improve performance
Reviewed-by: pbk, kamg, dlong, kvn, fparain
author | coleenp |
---|---|
date | Wed, 13 Jun 2012 19:52:59 -0400 |
parents | 1d1603768966 |
children | d2a62e0f25eb |
line wrap: on
line diff
--- a/src/share/vm/utilities/hashtable.inline.hpp Mon Jun 11 13:10:14 2012 -0400 +++ b/src/share/vm/utilities/hashtable.inline.hpp Wed Jun 13 19:52:59 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,27 +30,6 @@ // Inline function definitions for hashtable.hpp. - -// -------------------------------------------------------------------------- -// Hash function - -// We originally used hashpjw, but hash P(31) gives just as good results -// and is slighly faster. We would like a hash function that looks at every -// character, since package names have large common prefixes, and also because -// hash_or_fail does error checking while iterating. - -// hash P(31) from Kernighan & Ritchie - -inline unsigned int BasicHashtable::hash_symbol(const char* s, int len) { - unsigned int h = 0; - while (len-- > 0) { - h = 31*h + (unsigned) *s; - s++; - } - return h; -} - - // -------------------------------------------------------------------------- // Initialize a table.