perf(android): [Init Reflection 3] Gate Compose class probes behind their features#5637
Open
runningcode wants to merge 3 commits into
Open
perf(android): [Init Reflection 3] Gate Compose class probes behind their features#5637runningcode wants to merge 3 commits into
runningcode wants to merge 3 commits into
Conversation
The Compose gesture and view hierarchy class lookups ran during init regardless of configuration. Gate the gesture locators behind enableUserInteractionBreadcrumbs/Tracing and the Compose view hierarchy exporter behind attachViewHierarchy, so the Compose class probes only run when a feature that consumes them is enabled. Repeated probes of the Compose class across both blocks are deduplicated by LoadClass's cache. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
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.
PR Stack (Init Reflection)
Part of JAVA-587
📜 Description
The Compose gesture and view-hierarchy class lookups ran during
initregardless of configuration. Probingandroidx.compose.ui.node.Owneris the most expensive lookup in the trace (it triggersOwner.<clinit>before [Init Reflection 1]).This gates them behind the features that actually consume them:
enableUserInteractionBreadcrumbs || enableUserInteractionTracingattachViewHierarchy(defaultfalse)Repeated
COMPOSE_CLASS_NAMEprobes across the two blocks are deduplicated by theLoadClasscache from [Init Reflection 2].💡 Motivation and Context
Third of three stacked PRs reducing reflection cost on the init path (customer-provided Perfetto trace, Reduce SDK init time [Android]).
💚 How did you test it?
New
AndroidOptionsInitializerTestcases: no gesture locators when user interaction tracking is disabled; no Compose view-hierarchy exporter whenattachViewHierarchyis off; exporter present when enabled and Compose is available. Fullsentry-android-coreunit tests pass.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Top of the Init Reflection stack.
⏱️ Pixel 3 benchmark (ART method trace → Perfetto trace_processor)
With user interaction tracking and view hierarchy capture disabled, the Compose class probes init used to run unconditionally:
ClassNotFoundExceptionconstructions