-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
HBASE-25510 Optimize TableName.valueOf from O(n) to O(1) #2885
base: master
Are you sure you want to change the base?
Conversation
I edited the summary to remove square brackets around the JIRA number. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
It is a bit strange that we convert bytes or ByteBuffer to String, and then convert back to store them... |
In face, i tryed to use ByteBuffer as hash key. But there ars some reasons i choose String finally.
Benchmark Result For ByteBuffer: Benchmark Result For String: |
I think the problem is we convert it back to bytes. Could we introduce an internal methods which takes both string and bytes? So after checking the cache, we need to use bytes to create a new TableName, we just use it directly instead of converting the String back. |
The matter is we can't believe outside bytes(because it can be modifyed outside). So we have to go through two conversions. The diff is below:
So, I think we choose 1 here is not a problem |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
In the constructor of TableName, we will copy the bytes out. So let's avoid the extra converting? |
Any updates here? Thanks. |
Optimize TableName.valueOf from O(n) to O(1). We can get benefits when the number of tables in the cluster is greater than dozens