mdproctor opened a new issue, #6728:
URL: https://github.com/apache/incubator-kie-drools/issues/6728

   ## Context
   `ReteCompiledEngine.createUnit()` currently iterates 
`sourceToSlot.entrySet()` to subscribe DataStore adapters. This is on the hot 
path (called per unit instance creation) and uses map iteration, boxing, and 
identity hash map overhead.
   
   ## Required design
   At compile() time, assign each DataSource accessor a compact integer slot 
index (0..N-1). Store results as parallel arrays:
   - `Object[] accessors` — one accessor per slot
   - `ContextRouterAdapter[] adapters` — one adapter per slot (populated lazily 
on first createUnit())
   
   createUnit() then iterates:
   ```java
   for (int i = 0; i < slotCount; i++) {
       Object ds = ((Function1<CTX, DataSource<?>>) accessors[i]).apply(ctx);
       // ...subscribe adapter[i]...
   }
   ```
   
   Slot assignments must be dense (no gaps). Vol1 recycled arrays with compact 
slot assignment for the same reason. IdentityHashMap-based sourceToSlot stays 
for build-time use only.
   
   ## Note
   All vol2 evaluation is single-threaded (command-loop model) — no concurrent 
data structures needed.
   
   Refs #6724


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to