Reading the invaluable responses here is the highlight - the highlights will be helpful if there is part two on this subject.
Use a Microbenchmarking framework like JMH to see realistic results.
StringBuilder has a more complex API than String, so it's worth identifying the pivot point "k" for which StringBuilder becomes faster than String, making it easy to decide whether to use String or StringBuilder.
Do not pass String and StringBuilder as method parameters; instead, create String and StringBuilder inside the test functions and at the and use toString() to return the response.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Reading the invaluable responses here is the highlight - the highlights will be helpful if there is part two on this subject.
Use a Microbenchmarking framework like JMH to see realistic results.
StringBuilder has a more complex API than String, so it's worth identifying the pivot point "k" for which StringBuilder becomes faster than String, making it easy to decide whether to use String or StringBuilder.
Do not pass String and StringBuilder as method parameters; instead, create String and StringBuilder inside the test functions and at the and use toString() to return the response.