| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Avoid constructing Calendar instances when DateUtils only needs the current epoch millis or a Date for an existing millis value. Date stores epoch millis without timezone state, so the returned values are unchanged while avoiding unnecessary Calendar allocation and field computation. Co-Authored-By: Claude <noreply@anthropic.com>
📲 Install BuildsAndroid
|
Sorry, something went wrong.
Performance metrics 🚀
Baseline results on branch: perf/sdk-overhead-reductionStartup times
App size
Previous results on branch: perf/sdk-overhead-reduction-date-utilsStartup times
App size
|
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM 👍
Sorry, something went wrong.
|
Cursor review |
Sorry, something went wrong.
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d2ebaed. Configure here.
Sorry, something went wrong.
There was a problem hiding this comment.
Much simpler and faster! Great
Sorry, something went wrong.
…o perf/sdk-overhead-reduction-date-utils # Conflicts: # CHANGELOG.md
…uction-date-utils
Instructions and example for changelogPlease add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number. Example: ## Unreleased
### Performance
- [SDK Overhead Reduction 5] Replace Calendar with Date in DateUtils ([#5589](https://github.com/getsentry/sentry-java/pull/5589))If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Stack (SDK Overhead Reduction)
📜 Description
Replace Calendar.getInstance(TIMEZONE_UTC).getTime() with new Date() in DateUtils.getCurrentDateTime(), and replace the Calendar conversion in DateUtils.getDateTime(long) with new Date(millis).
Date stores epoch milliseconds and has no timezone state, so the returned values are unchanged. The UTC Calendar was only doing unnecessary allocation and calendar field computation before returning the same epoch millis as a Date.
Also update a stale Breadcrumb memoization comment that referenced Calendar allocation.
💡 Motivation and Context
Part of the SDK Overhead Reduction stack. DateUtils is used in hot event, breadcrumb, and session timestamp paths. Constructing Calendar for these helpers is unnecessary because no calendar fields are used. The change keeps Android/JDK compatibility and avoids introducing java.time or desugaring requirements.
💚 How did you test it?
📝 Checklist
🔮 Next steps
More SDK overhead reduction PRs in this stack.