essobedo opened a new pull request, #8570: URL: https://github.com/apache/camel/pull/8570
Fix for https://issues.apache.org/jira/browse/CAMEL-16354 ## Motivation Using `Scanner` to use for splitting could potentially be optimized for more basic splitting by single char as we do for commas. The Scanner creates a lot of object allocations with reg exp patterns and whatnot that is way overkill. ## Modifications: * Fix warnings in `ObjectHelperTest` * Add new tests to improve the code coverage of `ObjectHelper.createIterable` * Improve the performance in case the separator is not a pattern ## Results: ``` # JMH version: 1.35 # VM version: JDK 11, OpenJDK 64-Bit Server VM, 11+28 # VM invoker: /usr/local/jdk-11/bin/java # VM options: <none> # Blackhole mode: full + dont-inline hint (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 5 iterations, 10 s each # Measurement: 5 iterations, 10 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op Benchmark (type) Mode Cnt Score Error Units MyBenchmark.newSplitterWithSpecificSeparator TINY avgt 15 98.854 ± 0.592 ns/op MyBenchmark.newSplitterWithSpecificSeparator SMALL avgt 15 321.351 ± 13.413 ns/op MyBenchmark.newSplitterWithSpecificSeparator MEDIUM avgt 15 2905.660 ± 17.381 ns/op MyBenchmark.newSplitterWithSpecificSeparator BIG avgt 15 28820.933 ± 81.483 ns/op Benchmark (type) Mode Cnt Score Error Units MyBenchmark.currentSplitterWithSpecificSeparator TINY avgt 15 1722.947 ± 7.436 ns/op MyBenchmark.currentSplitterWithSpecificSeparator SMALL avgt 15 3795.835 ± 22.725 ns/op MyBenchmark.currentSplitterWithSpecificSeparator MEDIUM avgt 15 29253.195 ± 118.111 ns/op MyBenchmark.currentSplitterWithSpecificSeparator BIG avgt 15 281669.154 ± 4146.332 ns/op ``` Where: - `TINY` has 3 tokens to extract - `SMALL` has 10 tokens to extract - `MEDIUM` has 100 tokens to extract - `BIG` has 1000 tokens to extract -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
