Repository navigation
Commit 69bdef7
perf(android): Parse app start profiling config without JsonSerializer (#5867)
* perf(android): Parse app start profiling config without JsonSerializer (JAVA-621)
SentryPerformanceProvider.launchAppStartProfiler ran in ContentProvider.onCreate
— main thread, before Application.onCreate, on every cold start — and built a
full JsonSerializer(SentryOptions.empty()) to read one small config file.
That path only ever reads options.getLogger(), but JsonSerializer's constructor
registers every known deserializer to use exactly one of them. Calling the
deserializer directly cuts the parse from 221 to 33 allocations and ~7.5us to
~3.7us (Pixel 10, androidx Microbenchmark, allocationCount is deterministic).
Malformed input still yields null so callers keep reporting it as a
deserialization failure rather than a read error.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* changelog
* ref(android): Catch only expected exceptions when parsing profiling config
Narrow the deserialization catch from Throwable to Exception. The vendored JSON
reader signals bad input with IOException (MalformedJsonException, EOFException),
IllegalStateException on token type mismatch, and NumberFormatException on an
unparseable number — all Exception subclasses. Catching Throwable additionally
swallowed Error, which is never a recoverable "config file is bad" signal.
This also restores parity with JsonSerializer.deserialize, which catches
Exception, so the replaced behaviour is matched exactly rather than widened.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* ref(android): Trim javadoc on deserializeProfilingConfig
Drop the paragraph enumerating which exception types the vendored JSON reader
throws. That catch (Exception) does not swallow Error is a language-level
given, and listing the reader's internal exception types invites the comment
to drift as that code changes. The rationale a reader cannot infer from the
code — why the deserializer is called directly, and why null is returned
instead of rethrowing — stays.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 337a9f1 commit 69bdef7
3 files changed
Lines changed: 37 additions & 3 deletions
File tree
- sentry-android-core/src
- main/java/io/sentry/android/core
- test/java/io/sentry/android/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | | - | |
| 120 | + | |
122 | 121 | | |
123 | 122 | | |
124 | 123 | | |
| |||
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
169 | 187 | | |
170 | 188 | | |
171 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
156 | 171 | | |
157 | 172 | | |
158 | 173 | | |
| |||
0 commit comments