nl_tokens: http : // jsperf . com / hashing - strings
pl_tokens: function hashString ( string ) { // This is the hash from JVM // The hash code for a string is computed as // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], // where s[i] is the ith character of the string and n is the length of // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 // (exclusive) by dropping high bits. var hash = 0 ; for ( var ii = 0 ; ii < string . length ; ii ++ ) { hash = 31 * hash + string . charCodeAt ( <mask> ) | 0 ; } return smi ( hash ) ; }