Parse hex strings to numbers more efficiently#4160
Parse hex strings to numbers more efficiently#4160bbakerman merged 1 commit intographql-java:masterfrom
Conversation
Use the Integer.parseInt variant added in Java 9 that allows parsing of numbers from a String with offsets, avoiding the need to create any substrings.
c33bece to
91fa11f
Compare
|
@kilink how did you find this improvement? profiler or some static code analysis? something else? |
|
The performance will be the removal of the subsrtring iteration and memory allocation
|
A combination of flame graphs from services, and just reading lots of code and seeing patterns. For instance, I'm not sure when exactly graphql-java started targeting JDK 11, but whenever we move the baseline up I see it as an opportunity to leverage new APIs that are either more efficient or more concise. Some of this is just proactive and something I enjoy contributing. |
Thanks for contributing! |
Use the Integer.parseInt variant added in Java 9 that allows parsing of numbers from a String with offsets, avoiding the need to create any substrings.