You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Joiner.on(", ").join(datapoints) can be bottleneck if ArrayList 'datapoints' is large because Joiner uses StringBuilder to append each data in String, but the capacity of StringBuilder is not pre-determined, so it continuously copies whole array whenever it exceeds its capacity.
It is recommend not to use Joiner in this case because it handles arbitrary length of ArrayLists. How about change the code to use StringBuilder directly with proper initialCapacity?
The text was updated successfully, but these errors were encountered:
Currently only JSON response is supported, but it can cause serious performance issue.
The following is code block from ResponseFormatter.java.
Joiner.on(", ").join(datapoints) can be bottleneck if ArrayList 'datapoints' is large because Joiner uses StringBuilder to append each data in String, but the capacity of StringBuilder is not pre-determined, so it continuously copies whole array whenever it exceeds its capacity.
Here is the reference:
https://docs.oracle.com/javase/tutorial/java/data/buffers.html
It is recommend not to use Joiner in this case because it handles arbitrary length of ArrayLists. How about change the code to use StringBuilder directly with proper initialCapacity?
The text was updated successfully, but these errors were encountered: