You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "Croway (via GitHub)" <gi...@apache.org> on 2026/04/16 11:02:18 UTC
[PR] camel-jbang: pre-compile grep/find patterns and cache SimpleDateFormat [camel]
Croway opened a new pull request, #22655:
URL: https://github.com/apache/camel/pull/22655
## Summary
- Pre-compile `--grep` and `--find` regex patterns once at startup instead of calling `Pattern.compile()` on every log/trace line in the follow loop
- Cache `SimpleDateFormat` instances as fields instead of creating new ones per line
- Add missing `Pattern.quote()` in `CamelStubAction` for consistency with the other 3 action commands
- Extract shared `quoteAndCompilePatterns()` helper into `ActionBaseCommand`
Files changed: `ActionBaseCommand`, `CamelLogAction`, `CamelTraceAction`, `CamelReceiveAction`, `CamelStubAction`
## Benchmark results
I know it is not a huge difference, but better than nothing — these add up when tailing high-throughput logs with `camel log --follow --grep=ERROR`:
```
=== Fix 1: Pattern.compile per-line vs pre-compiled ===
isValidGrep (500000 iterations, 2 grep terms, 10 log lines):
OLD (Pattern.compile per line): 296.92 ms (150000 matches)
NEW (pre-compiled): 141.01 ms (150000 matches)
Speedup: 2.11x
replaceAll highlighting (500000 iterations, 2 patterns):
OLD (replaceAll per line): 358.34 ms
NEW (compiled matcher): 161.19 ms
Speedup: 2.22x
=== Fix 2: SimpleDateFormat per-line vs cached ===
SDF.format() (500000 iterations):
OLD (new SDF per call): 303.78 ms
NEW (cached SDF): 94.02 ms
Speedup: 3.23x
SDF.parse() (500000 iterations):
OLD (new SDF per call): 377.68 ms
NEW (cached SDF): 249.19 ms
Speedup: 1.52x
```
## Test plan
- [x] `mvn -DskipTests install` in `camel-jbang-core` — compiles clean
- [x] `mvn formatter:format impsort:sort` — no changes needed
- [x] `camel-jbang-core` unit tests pass
- [x] `camel-jbang-it` integration tests pass
_Claude Code on behalf of Federico Mariani_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] camel-jbang: pre-compile grep/find patterns and cache SimpleDateFormat - perf improvements [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #22655:
URL: https://github.com/apache/camel/pull/22655#issuecomment-4260989698
The CI is working now, the error are due to camel-spring-boot 4.20.0-SNAPSHOT not deployed yet. tomorrow I'll rerun the pipelines. Please do not merge this PR
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] camel-jbang: pre-compile grep/find patterns and cache SimpleDateFormat - perf improvements [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22655:
URL: https://github.com/apache/camel/pull/22655#issuecomment-4259502039
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] camel-jbang: pre-compile grep/find patterns and cache SimpleDateFormat - perf improvements [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22655:
URL: https://github.com/apache/camel/pull/22655#issuecomment-4259597155
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `dsl/camel-jbang/camel-jbang-core`
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `dsl/camel-jbang/camel-jbang-core`: 1 test(s) disabled on GitHub Actions
:bulb: **Manual integration tests recommended:**
> You modified `dsl/camel-jbang/camel-jbang-core`. The related integration tests in `dsl/camel-jbang/camel-jbang-it` are excluded from CI. Consider running them manually:
> ```
> mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
> ```
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/24506673102)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] camel-jbang: pre-compile grep/find patterns and cache SimpleDateFormat - perf improvements [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway merged PR #22655:
URL: https://github.com/apache/camel/pull/22655
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org