nfsantos opened a new pull request, #1515: URL: https://github.com/apache/jackrabbit-oak/pull/1515
Using String concatenation in this case is much faster, because the JVM will use invokedynamic to concatenate the Strings. The method `PathUtils.concat(String, String)` is heavily used by Oak, so it is worth to optimize. With the following test code, using String concatenation provides a 2x speedup: ``` public static void main(String[] args) { var p1 = "parent"; var start = Stopwatch.createStarted(); long totalSize = 0; for (int i = 0; i < 500_000_000; i++) { totalSize += PathUtils.concat(p1, "child"+i).length(); } System.out.println("totalSize: " + totalSize + " start.elapsed() = " + start.elapsed(TimeUnit.MILLISECONDS) + " ms" ); } ``` Baseline, with StringBuilder: ``` TotalSize: 10388888890 Duration: 21056 ms ``` Optimized with String concatenation: ``` TotalSize: 10388888890 Duration: 11215 ms ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org