gnodet opened a new pull request, #23771:
URL: https://github.com/apache/camel/pull/23771

   [CAMEL-23686](https://issues.apache.org/jira/browse/CAMEL-23686)
   
   ## Summary
   
   - Replace `ConcurrentLinkedDeque<Route>` with a single `Route` field + 
lazily-created `ArrayDeque` for nested routes
   - Saves ~72 bytes per exchange in the common single-route case
   
   ## Problem
   
   Every `DefaultUnitOfWork` eagerly allocated a `ConcurrentLinkedDeque<Route>` 
(24 bytes + Node objects) even though most exchanges only traverse a single 
route. In a high-throughput pipeline processing ~1M exchanges/sec, this adds up 
to significant GC pressure.
   
   ## Changes
   
   - `Route route` field holds the current/top route (common case: single route)
   - `Deque<Route> routeStack` is lazily created only when `pushRoute()` is 
called while a route is already set (nested routes via `direct:`, kamelets, 
etc.)
   - `pushRoute()` / `popRoute()` / `getRoute()` / `routeStackLevel()` updated 
accordingly
   - `reset()` clears both fields
   - Extracted `countRoute()` helper for the filtered `routeStackLevel(boolean, 
boolean)` variant
   
   ## Test plan
   
   - [x] 43 UnitOfWork-related tests pass
   - [x] 230 camel-main tests pass
   - [x] Verified nested route scenarios still work (direct, kamelets, route 
templates)


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