Instead of creating a new Gson instance for each invocation, they are not static final fields to avoid the overhead of creating them each time. The Gson instance is threadsafe so there should be no issues (anymore).
I did a naive performance test with the old and my suggested approach. I also did a test to compare with jackson but could not find any notable difference.
Instead of creating a new Gson instance for each invocation, they are not static final fields to avoid the overhead of creating them each time. The Gson instance is threadsafe so there should be no issues (anymore).
I did a naive performance test with the old and my suggested approach. I also did a test to compare with jackson but could not find any notable difference.
Time in milliseconds
The difference is quite big, "almost" a second per 150.000 invocations.