Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ハッシュ関数の改善 #3

Open
cognitom opened this issue Jul 21, 2015 · 2 comments
Open

ハッシュ関数の改善 #3

cognitom opened this issue Jul 21, 2015 · 2 comments

Comments

@cognitom
Copy link
Owner

現在の実装(下)だと、全国で100件程度の衝突がある模様。どのようにパラメータを調整するべきか...

djb = (s) ->
  s.split('').reduce (h, str) ->
    ((h << 5) + h + str.charCodeAt 0) >>> 0
  , 5381
@cognitom
Copy link
Owner Author

最適なハッシュ関数の生成にgperfが使えるらしいです。Twitterで教えてもらいました。JavaScriptの関数も生成できるっぽいですね。

@cognitom
Copy link
Owner Author

perfect-hashブランチで、JavaScriptで使える実装を試しているのですが、Not foundにならない問題発生。Not foundを判定(100%じゃなくてよいので)できるものを探します...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant