-
Notifications
You must be signed in to change notification settings - Fork 5.1k
CAMEL-16354: camel-core - Optimize Splitters using Scanner #8570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 If necessary Apache Camel Committers may access logs and test results in the job summaries! |
7568207 to
d33bb02
Compare
d33bb02 to
7c8abac
Compare
|
🚫 There are (likely) no components to be tested in this PR |
1 similar comment
|
🚫 There are (likely) no components to be tested in this PR |
|
🚫 There are (likely) no components to be tested in this PR |
|
@davsclaus Is it what you had in mind when first created the ticket? |
|
🚫 There are (likely) no components to be tested in this PR |
2 similar comments
|
🚫 There are (likely) no components to be tested in this PR |
|
🚫 There are (likely) no components to be tested in this PR |
|
Yeah this is great - the increased performance is great, and also with reduced object allocations as well. |
Fix for https://issues.apache.org/jira/browse/CAMEL-16354
Motivation
Using
Scannerto 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:
ObjectHelperTestObjectHelper.createIterableResults:
JMH Settings/Environment
Literal Separator
=> The new approach is about 10 times faster with a more predictable average time whatever the number of tokens to extract
Pattern Separator
=> The new approach is about 5 times faster with a more predictable average time whatever the number of tokens to extract
Where:
TINYhas 3 tokens to extractSMALLhas 10 tokens to extractMEDIUMhas 100 tokens to extractBIGhas 1000 tokens to extractNB: Lower score is better as it is expressed in nanoseconds per operation