Skip to content

API rule regex optimization#13109

Open
sureshanaparti wants to merge 3 commits intoapache:4.22from
shapeblue:api-rule-regex-optimization
Open

API rule regex optimization#13109
sureshanaparti wants to merge 3 commits intoapache:4.22from
shapeblue:api-rule-regex-optimization

Conversation

@sureshanaparti
Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti commented May 6, 2026

Description

This PR optimizes the API rule regex, to compile the pattern once in the constructor and store it in a compiledPattern field, instead of recompiling via String.matches() on every matches() call.

With ~879 APIs checked per getApisAllowedToAccount, that's ~879 pattern compilations per invocation. Pre-compiling the pattern in the constructor would eliminate this.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

sliceofapplepie and others added 3 commits May 6, 2026 20:36
Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.68%. Comparing base (3e688b0) to head (0e7640e).

Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #13109   +/-   ##
=========================================
  Coverage     17.68%   17.68%           
  Complexity    15792    15792           
=========================================
  Files          5922     5922           
  Lines        533087   533088    +1     
  Branches      65206    65206           
=========================================
+ Hits          94269    94271    +2     
  Misses       428176   428176           
+ Partials      10642    10641    -1     
Flag Coverage Δ
uitests 3.69% <ø> (ø)
unittests 18.76% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants