Skip to content

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Apr 22, 2025

📜 Description

  • Use class.getName instead of class.getCanonicalName as it's almost ~2x faster, and there's almost no difference in what it returns except for inner classes (tested 10k iterations over 10 times)
Google Chrome 2025-04-21 10 46 11
  • Fix SentryTag extraction for compose, because SentryTagModifierNodeElement is an inner class and we have to use a dollar-sign to properly get its class name.

  • Use fori instead of foreach loop to avoid allocating an Iterator in hot paths (e.g. when traversing the view hierarchy which can happen 100s of times for complex UIs). Reduced allocations by almost 2x doing the same user flow (launch -> scroll -> button click)

Before

Android Studio 2025-04-21 23 12 32

After

Android Studio 2025-04-21 23 15 46

💡 Motivation and Context

Improve perf of user interaction tracing

💚 How did you test it?

existing tests

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

🙏 👏

@github-actions
Copy link
Contributor

github-actions bot commented Apr 22, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 420.12 ms 484.44 ms 64.32 ms
Size 1.58 MiB 2.08 MiB 507.26 KiB

Previous results on branch: rz/perf/faster-gesture-tracking

Startup times

Revision Plain With Sentry Diff
148e92b 442.19 ms 539.20 ms 97.01 ms

App size

Revision Plain With Sentry Diff
148e92b 1.58 MiB 2.08 MiB 507.26 KiB

@romtsn romtsn enabled auto-merge (squash) April 22, 2025 10:31
@romtsn romtsn merged commit 5b790bc into main Apr 22, 2025
38 checks passed
@romtsn romtsn deleted the rz/perf/faster-gesture-tracking branch April 22, 2025 10:43
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.

3 participants