reuvenlax opened a new pull request, #41816:
URL: https://github.com/apache/beam/pull/41816

   Stacked on #41815 (`perf/simple-dofn-runner-only`, in the linear stack 
`#41813 -> #41814 -> #41815 -> this PR`; functionally depends only on #41813 
`perf/windowed-values`).
   
   Eliminates per-element builder, lambda, iterator, and `Instant` allocations 
in `FnApiDoFnRunner`:
   
   - Fast-paths single-window elements in 
`processElementForWindowObservingParDo` using 
`WindowedValues.singleWindowOrNull()`, avoiding `getWindows().iterator()` 
allocation.
   - Implements direct `output`, `outputWithTimestamp`, and 
`outputWindowedValue` methods on `ProcessBundleContextBase`, 
`OnWindowExpirationContext`, `OnTimerContext`, row receivers, and tagged 
receivers using `WindowedValues.ofWithCurrentContext(...)` and 
`WindowedValues.builder(currentElement, value)`.
   - Pre-resolves `FnDataReceiver` once per `TupleTag` when creating tagged 
receivers and replaces `computeIfAbsent(tag, this::...)` with `get`/`put` to 
avoid capturing-lambda allocations on cache hits.
   - Uses primitive `long` arithmetic in a unified `checkOutputTimestamp` 
helper for element, timer, and window-expiration outputs, and uses 
`currentTimer.causedByDrain()` consistently in `OnTimerContext`.
   - Adds unit tests in `FnApiDoFnRunnerTest` covering 
row/tagged/timer/window-expiration/non-window-observing fast paths and 
unknown-tag handling.
   
   *(Replaces fork-based #41807 to use native GitHub stacked PRs.)*
   


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