Skip to content

perf(core): [SDK Overhead reduction for JVM 3] Reduce writer buffer size#5544

Merged
adinauer merged 4 commits into
perf/sdk-overhead-jvm-v2from
perf/sdk-overhead-jvm-writer-buffer-512
Jun 18, 2026
Merged

perf(core): [SDK Overhead reduction for JVM 3] Reduce writer buffer size#5544
adinauer merged 4 commits into
perf/sdk-overhead-jvm-v2from
perf/sdk-overhead-jvm-writer-buffer-512

Conversation

@adinauer

@adinauer adinauer commented Jun 15, 2026

Copy link
Copy Markdown
Member

PR Stack (SDK Overhead reduction for JVM)


📜 Description

Set an explicit 512-character BufferedWriter buffer for envelope item and envelope serialization.

This keeps the existing OutputStreamWriter-based UTF-8 encoding path and does not introduce a custom writer implementation.

💡 Motivation and Context

This implements the safe AR-13 serialization buffer-size optimization from the SDK overhead reduction research. The JDK BufferedWriter default allocates an 8192-character buffer for each short-lived serialization writer, which is oversized for typical envelope item JSON payloads.

Using a smaller explicit buffer reduces temporary allocation overhead while preserving serialization behavior.

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry:test --tests io.sentry.SentryEnvelopeItemTest --tests io.sentry.JsonSerializerTest

📝 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.

adinauer and others added 2 commits June 12, 2026 10:36
Use an explicit 512-character BufferedWriter buffer for envelope item and envelope serialization. This avoids allocating the oversized default char buffer for each short-lived serialization writer while preserving the existing OutputStreamWriter-based encoding path.

Co-Authored-By: Claude <noreply@anthropic.com>
@sentry

sentry Bot commented Jun 15, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 317.56 ms 364.46 ms 46.90 ms
Size 0 B 0 B 0 B

Baseline results on branch: perf/sdk-overhead-jvm-v2

Startup times

Revision Plain With Sentry Diff
d346c71 324.53 ms 363.54 ms 39.01 ms

App size

Revision Plain With Sentry Diff
d346c71 0 B 0 B 0 B

Previous results on branch: perf/sdk-overhead-jvm-writer-buffer-512

Startup times

Revision Plain With Sentry Diff
226835a 314.28 ms 367.69 ms 53.41 ms
f7243b2 320.19 ms 374.33 ms 54.14 ms

App size

Revision Plain With Sentry Diff
226835a 0 B 0 B 0 B
f7243b2 0 B 0 B 0 B

@adinauer adinauer force-pushed the perf/sdk-overhead-jvm-v2 branch from 51c339c to 7c1a728 Compare June 18, 2026 12:58
@adinauer adinauer marked this pull request as ready for review June 18, 2026 13:18
@adinauer adinauer merged commit 60e4562 into perf/sdk-overhead-jvm-v2 Jun 18, 2026
48 checks passed
@adinauer adinauer deleted the perf/sdk-overhead-jvm-writer-buffer-512 branch June 18, 2026 13:18
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