Skip to content

perf(core): [SDK Overhead Reduction 12] Avoid cloning Date getters#5603

Draft
adinauer wants to merge 1 commit into
perf/sdk-overhead-reductionfrom
perf/sdk-overhead-reduction-date-getters
Draft

perf(core): [SDK Overhead Reduction 12] Avoid cloning Date getters#5603
adinauer wants to merge 1 commit into
perf/sdk-overhead-reductionfrom
perf/sdk-overhead-reduction-date-getters

Conversation

@adinauer

@adinauer adinauer commented Jun 23, 2026

Copy link
Copy Markdown
Member

PR Stack (SDK Overhead Reduction)


📜 Description

Avoid cloning mutable Date values from SDK data model getters. These getters now return the stored Date reference directly, matching the broader SDK behavior of exposing mutable model data through getters.

💡 Motivation and Context

The SDK already returns mutable internals for many model fields, including maps, lists, arrays, and Device.timezone. Cloning Date values on every getter call adds allocation overhead without providing consistent immutability across the SDK data model surface.

💚 How did you test it?

  • ./gradlew :sentry:test --tests io.sentry.BreadcrumbTest --tests io.sentry.SentryEventTest --tests io.sentry.protocol.AppTest --tests io.sentry.protocol.DeviceTest --tests io.sentry.protocol.SessionSerializationTest --tests io.sentry.SessionAdapterTest
  • ./gradlew spotlessApply apiDump

📝 Checklist

  • I added GH Issue ID & Linear ID
  • 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

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

@sentry

sentry Bot commented Jun 23, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.43.1 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 318.35 ms 376.12 ms 57.77 ms
Size 0 B 0 B 0 B

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.

1 participant