Skip to content

Conversation

@kamilkrzywanski
Copy link
Contributor

Replaced String-based split with a compiled Pattern to avoid repeated pattern compilation

@codecov-commenter
Copy link

codecov-commenter commented Oct 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.0037%. Comparing base (4e0dc1a) to head (5fac7b4).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2323        +/-   ##
==================================================
- Coverage     67.0088%   67.0037%   -0.0052%     
+ Complexity      29326      29325         -1     
==================================================
  Files            1382       1382                
  Lines          116604     116604                
  Branches        20427      20427                
==================================================
- Hits            78135      78129         -6     
- Misses          32036      32038         +2     
- Partials         6433       6437         +4     
Files with missing lines Coverage Δ
...a/org/codehaus/groovy/vmplugin/v9/ClassFinder.java 74.0741% <100.0000%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@paulk-asert paulk-asert requested a review from Copilot November 29, 2025 22:09
Copilot finished reviewing on behalf of paulk-asert November 29, 2025 22:11
@paulk-asert paulk-asert merged commit 0c467cc into apache:master Nov 29, 2025
19 checks passed
@paulk-asert
Copy link
Contributor

Merged, thanks!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the ClassFinder.find() method by pre-compiling the path separator regex pattern instead of compiling it on every split() call. The optimization is particularly valuable because the pattern is reused in the visitFile() callback which may be invoked many times during file tree traversal.

Key Changes:

  • Pre-compile the path separator pattern once using Pattern.compile(Pattern.quote(...))
  • Replace String.split() calls with Pattern.split() to use the compiled pattern
  • Apply the optimization to two split operations: one on the prefix path and one inside the file visitor callback

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants