Reduce per-component request-pipeline overhead#5777
Merged
Conversation
ConcurrentHashMap.computeIfAbsent() does more work than get() even on a hit, which is the steady state for these per-class/per-component caches (renderer event info, property descriptors). Probe with a plain get() first and fall back to computeIfAbsent() only on a miss; the populate race stays atomic. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
disabled/readonly are declared boolean properties on the components these helpers run against, so the attribute value is always a Boolean. Read it directly (mirroring UIComponent.isRendered()) instead of routing through String.valueOf()+parseBoolean(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e copy The PostAddToViewEvent walk copied each component's children into a fresh ArrayList per node to guard against a listener relocating children mid-iteration (e.g. composite cc:insertChildren). Iterate the live list by index and re-check the slot after recursing instead: if it changed, the component was relocated, so process whatever now occupies it. Detects relocation after the fact, so no defensive copy and no listener-subscription knowledge is needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
setParent guarded re-entrant event processing with a private ".ADDED" attribute, whose get/put/remove on every (re)parent routed through the reflective AttributesMap (getPropertyDescriptor miss then StateHelper lookup) -- the single hottest AttributesMap.get caller. Replace it with a plain boolean field read directly in setParent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
BalusC
added a commit
that referenced
this pull request
Jun 8, 2026
BalusC
added a commit
that referenced
this pull request
Jun 8, 2026
pzygielo
pushed a commit
to pzygielo/mojarra
that referenced
this pull request
Jun 8, 2026
Omits eclipse-ee4j#5777's Cache get()-probe commit: 4.0's Cache.get() already probes with get() before putIfAbsent (it never switched to computeIfAbsent), so that change is a no-op on 4.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four optimizations on the per-component hot paths that run once (or more) per component per request, especially view build time and component tree walking.
UIComponentBase.setParent— field-back the.ADDEDre-entrancy guard. It was written/read/removed as a private attribute on everysetParent, routing through the reflectiveAttributesMap(property-descriptor miss →StateHelperlookup) each time; a plainbooleanfield avoids that entirely. Always cleared before returning, so it's never carried in saved state.UIComponentBase.publishAfterViewEvents— iterate the live children list with a slot re-check instead of allocating anArrayListdefensive copy per node. Still safe against listeners that relocate children mid-walk (e.g. compositecc:insertChildren). Facets keep the small copy.Util.componentIsDisabled/componentIsDisabledOrReadonly— read thedisabled/readonlyattribute directly withBoolean.TRUE.equals(...)instead ofString.valueOf(...)+parseBoolean(...). These are declared boolean properties, so the stored value is always aBoolean.Cache.get— probe with a plainget()beforecomputeIfAbsent(). Steady state is a hit, andConcurrentHashMap.get()is cheaper thancomputeIfAbsent(), which does extra work even on a present key. Falls back tocomputeIfAbsent()on a miss, preserving atomic population.Adds
UIComponentBaseTestCasecoverage for thesetParentre-entrancy guard.Part of #5753.