Aias00 opened a new issue, #6579:
URL: https://github.com/apache/shenyu/issues/6579

   ## Description
   On cache miss, `matchSelector`/`matchRule` do 
`selectors.stream().filter(...).distinct().collect(Collectors.toList())` (new 
ArrayList), and `manyMatchSelector` builds 
`Collectors.groupingBy(Pair::getLeft)` with `Pair.of(sort, selector)` — 
autoboxing the `int sort` into `Integer` keys in a `Map<Integer, 
List<Pair<Integer,SelectorData>>>`, plus `Collections.max(collect.keySet())` 
and a final `stream().map(...).min(...)`.
   
   ## Location
   ```
   shenyu-plugin-base/.../AbstractShenyuPlugin.java:229-239 (matchSelector), 
241-256 (manyMatchSelector), 268-292 (matchRule/manyMatchRule)
   ```
   
   ## Impact
   Per cache-miss: 1 ArrayList + 1 HashMap (with Integer boxing) + N Pair 
objects. Steady garbage on cache churn (many distinct paths).
   
   ## Suggested fix
   Replace the stream pipeline with a plain for-loop tracking the max-sort 
candidate directly; avoid `Pair` and the `Map<Integer,...>` boxing.
   
   ## Related existing issue(s)
   None
   
   _Identified during the 2026-08-02 audit; full list in 
[`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._


-- 
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]

Reply via email to