perf: String#getBytes(Charset) vs getBytes(String)#18
perf: String#getBytes(Charset) vs getBytes(String)#18phraktle wants to merge 3 commits intoprotocolbuffers:masterfrom
Conversation
|
Please sign this Google Individual Contributor License Agreement: and let me know when you are done. It's required for us to use your code. |
There was a problem hiding this comment.
This is a public method. Removing it will break existing clients. Please keep the old one and add a new method instead.
|
Filled out the CLA as requested. Will look into re-adding the method w/ the original signature shortly. |
|
Do you think the original method should be marked @deprecated ? |
|
No. The original method is used widely in our internal code base. Unless we are willing to do a global clean-up and replace all call-sites (which will take weeks or months and isn't worthwhile in this case), we shouldn't mark the old method as deprecated. |
There was a problem hiding this comment.
Please remove use of this StandardCharsets.
This StandardCharsets is introduced only since jdk 1.7. Our library supports back to jdk 1.5. We probably can drop 1.5 support soon but I believe jdk 1.6 will be supported for quite some time.
There was a problem hiding this comment.
Removed use of StandardCharsets. Since String#getBytes(Charset) was introduced in jdk 1.6 (which is the whole point of this change), support for jdk 1.5 cannot be provided.
There was a problem hiding this comment.
Please test both ByteString.toString(String) and ByteString.toString(Charset) here (you added a test case for the latter but removed the test case for the former).
Sync from Google-internal development.
…in-oneof Fix scalar types in oneof for proto3
Use the cleaner and slightly faster getBytes on Strings.