perf(core): [SDK Overhead reduction for JVM 1] Remove redundant event map copies#5536
Draft
adinauer wants to merge 1 commit into
Draft
perf(core): [SDK Overhead reduction for JVM 1] Remove redundant event map copies#5536adinauer wants to merge 1 commit into
adinauer wants to merge 1 commit into
Conversation
Avoid creating temporary maps when applying scope and options tags or scope extras. The event setters already copy these maps, so this preserves snapshot semantics while reducing allocation overhead. Co-Authored-By: Claude <noreply@anthropic.com>
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ee747ae | 357.79 ms | 421.84 ms | 64.05 ms |
| d15471f | 315.20 ms | 370.22 ms | 55.02 ms |
| 3998a95 | 415.94 ms | 478.54 ms | 62.60 ms |
| c8125f3 | 383.82 ms | 441.66 ms | 57.84 ms |
| cf708bd | 408.35 ms | 458.98 ms | 50.63 ms |
| ff8eea4 | 313.42 ms | 337.08 ms | 23.66 ms |
| ce0a49e | 532.00 ms | 609.96 ms | 77.96 ms |
| d15471f | 303.49 ms | 439.08 ms | 135.59 ms |
| 6edfca2 | 305.52 ms | 432.78 ms | 127.26 ms |
| 4fc476b | 280.63 ms | 363.04 ms | 82.42 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 3998a95 | 1.58 MiB | 2.10 MiB | 532.96 KiB |
| c8125f3 | 1.58 MiB | 2.10 MiB | 532.32 KiB |
| cf708bd | 1.58 MiB | 2.11 MiB | 539.71 KiB |
| ff8eea4 | 1.58 MiB | 2.28 MiB | 718.64 KiB |
| ce0a49e | 1.58 MiB | 2.10 MiB | 532.94 KiB |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 6edfca2 | 1.58 MiB | 2.13 MiB | 559.07 KiB |
| 4fc476b | 0 B | 0 B | 0 B |
This was referenced Jun 12, 2026
Closed
romtsn
approved these changes
Jun 12, 2026
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 (SDK Overhead reduction for JVM)
📜 Description
Remove redundant intermediate
HashMapcopies when applying scope and options tags, and scope extras, to events.The event setters still copy the provided maps, so this keeps event map containers isolated from the source scope/options maps while avoiding one temporary allocation per application path.
💡 Motivation and Context
This implements AR-04b from the SDK overhead reduction research. The previous code copied tags/extras before calling setters that already copy their input. Removing the extra copy reduces allocation overhead without exposing live scope or options maps to events.
💚 How did you test it?
./gradlew :sentry:test --tests io.sentry.SentryClientTest --tests io.sentry.MainEventProcessorTest --tests io.sentry.protocol.SentryBaseEventSerializationTest./gradlew spotlessApply apiDump📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
#skip-changelog