Skip to content

Commit 9766b74

Browse files
authored
Merge pull request #5591 from getsentry/perf/sdk-overhead-reduction-json-writer-stack
perf(core): [SDK Overhead Reduction 6] Reduce JsonWriter stack allocation
2 parents 4ec0df2 + e963ad5 commit 9766b74

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Internal
66

7+
- Reduce JSON serialization overhead by lowering the initial `JsonWriter` nesting stack size while preserving on-demand growth. ([#5591](https://github.com/getsentry/sentry-java/pull/5591))
78
- Reduce timestamp helper overhead by replacing unnecessary `Calendar` usage in `DateUtils` with direct `Date` creation. ([#5589](https://github.com/getsentry/sentry-java/pull/5589))
89
- Reduce Android startup overhead by using the default timezone directly on older devices or when no timezone info is available in the locale. ([#5587](https://github.com/getsentry/sentry-java/pull/5587))
910

sentry/src/main/java/io/sentry/vendor/gson/stream/JsonWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// Source: https://github.com/google/gson
1818
// Tag: gson-parent-2.8.7
1919
// Commit Hash: 4520489c29e770c64b11ca35e0a0fdf17a1874ab
20-
// Changes: @ApiStatus.Internal, SuppressWarnings
20+
// Changes: @ApiStatus.Internal, SuppressWarnings, reduced stack size
2121

2222
package io.sentry.vendor.gson.stream;
2323

@@ -175,7 +175,7 @@ public class JsonWriter implements Closeable, Flushable {
175175
/** The output data, containing at most one top-level array or object. */
176176
private final Writer out;
177177

178-
private int[] stack = new int[32];
178+
private int[] stack = new int[8];
179179
private int stackSize = 0;
180180
{
181181
push(EMPTY_DOCUMENT);

0 commit comments

Comments
 (0)