chaokunyang commented on PR #2445: URL: https://github.com/apache/fory/pull/2445#issuecomment-3204591754
Andriod String seems be implemented as a native class, we can't get `value` and `coder` field from String object. Here are two tricks to keep maxmimal performance: - Use `public void getBytes (int srcBegin, int srcEnd, byte[] dst, int dstBegin)` to get bytes for `JDK9+` - Use `String.toCharArray` for JDK8 Don't use `String.charAt`, it's much more slow than get chars array first and check by a loop. JVM can employ some optimzation for simple loops if it doesn't contains nested methods call -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
