Skip to content

RUM-15813: Cache reflection lookups in LayoutNodeUtils#3381

Merged
satween merged 1 commit into
release/3.9.0from
tvaleev/feature/RUM-15813
Apr 23, 2026
Merged

RUM-15813: Cache reflection lookups in LayoutNodeUtils#3381
satween merged 1 commit into
release/3.9.0from
tvaleev/feature/RUM-15813

Conversation

@satween

@satween satween commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Caches reflection lookups in the Compose LayoutNodeUtils fallback path. Method handles for getLayoutDelegate/getOuterCoordinator/getCoordinates are memoized per concrete LayoutNode subclass via a HashMap, and the LayoutCoordinatesKt.boundsInWindow reflection is resolved once through a lazy Method reference.

Motivation

Before this change, the reflection fallback (used until the Compose BOM bump in RUM-13454) ran a full javaClass.methods linear scan plus multiple Class.forName calls on every ACTION_MOVE hit-test, which is a hot path during touch tracking.

Before fix After fix
Screen_recording_20260422_180800.webm
Screen_recording_20260422_180849.webm

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@satween satween force-pushed the tvaleev/feature/RUM-15813 branch 2 times, most recently from 41c43b4 to c63143c Compare April 20, 2026 21:22
@codecov-commenter

codecov-commenter commented Apr 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.81%. Comparing base (f47ab32) to head (6075149).
⚠️ Report is 2 commits behind head on release/3.9.0.

Files with missing lines Patch % Lines
.../android/compose/internal/utils/LayoutNodeUtils.kt 94.29% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           release/3.9.0    #3381      +/-   ##
=================================================
- Coverage          71.96%   71.81%   -0.15%     
=================================================
  Files                948      948              
  Lines              34952    34973      +21     
  Branches            5804     5808       +4     
=================================================
- Hits               25152    25113      -39     
- Misses              8226     8267      +41     
- Partials            1574     1593      +19     
Files with missing lines Coverage Δ
.../android/compose/internal/utils/LayoutNodeUtils.kt 82.80% <94.29%> (+13.78%) ⬆️

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@satween satween force-pushed the tvaleev/feature/RUM-15813 branch 3 times, most recently from f3de345 to 92787b0 Compare April 22, 2026 12:14
@satween satween marked this pull request as ready for review April 22, 2026 12:15
@satween satween requested review from a team as code owners April 22, 2026 12:15
@satween satween requested review from 0xnm, InesDatadog and kikoveiga and removed request for InesDatadog April 22, 2026 12:17
@satween

satween commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@satween satween changed the base branch from develop to release/3.9.0 April 22, 2026 18:19
@satween satween requested a review from kikoveiga April 22, 2026 18:21

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I've added some questions. Also to double check maybe it is worth to get Frame/CPU stats as well for cases when there is no instrumentation enabled and also when instrumentation enabled, but with SDK state before #3259 fix

@satween satween force-pushed the tvaleev/feature/RUM-15813 branch from 92787b0 to 1cc6b4b Compare April 23, 2026 10:39
kikoveiga
kikoveiga previously approved these changes Apr 23, 2026

@kikoveiga kikoveiga left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just left some minor suggestions and the stale files FakeLayoutNodeUi.java & FakeLayoutNodeUiRelease.java are still present.

@satween satween force-pushed the tvaleev/feature/RUM-15813 branch from 33478a9 to 6075149 Compare April 23, 2026 13:52
@satween satween merged commit a0d8aa5 into release/3.9.0 Apr 23, 2026
26 checks passed
@satween satween deleted the tvaleev/feature/RUM-15813 branch April 23, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants