3 ms·
String.format is slow compared to normal string concatenation (i.e. "foo" + "bar")! Bit me once when using String.format in a hot path. https://stackoverflow.c
by cozos 7y ago
String.format is slow compared to normal string concatenation (i.e. "foo" + "bar")! Bit me once when using String.format in a hot path.
https://stackoverflow.com/questions/513600/should-i-use-javas-string-format-if-performance-is-important https://stackoverflow.com/questions/513600/should-i-use-java...
- vips7L 7y agoThose benchmarks can't be accurate as they don't use JMH. Edit: i do believe you that + is faster, as it doesn't need to parse the format string, but you should still always do benchmarks with JMH or they won't be accurate.