-
Notifications
You must be signed in to change notification settings - Fork 199
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
Optimize Cache lookup #1993
Optimize Cache lookup #1993
Conversation
2b42f9c
to
07e6867
Compare
Could you discuss the advantage of "hash key via string concat" vs "hash key as tuple"? |
The real win here is switching from tree based As for the difference between building a composite string vs hashing tuple elements, that would need to be profiled to get a definite answer. Unfortunately both idioms require string copies, but it's possible the tuple version uses shorter strings more and so we could trigger the small buffer optimization more often and avoid calls to malloc(). Offset that with multiple calls to your hash function instead of hashing one buffer in a single call. The standard library doesn't support arbitrary hashing of tuples, for that we would need something like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
This check causes a measurable slowdown in I/O heavy games. Use an assert() instead.
Also add some inlines
No description provided.