perf(replay): Use RGB_565 when alpha is unnecessary#5821
Draft
romtsn wants to merge 2 commits into
Draft
Conversation
Reduce replay screenshot memory while retaining ARGB_8888 for SurfaceView compositing. Refs GH-5340 Co-Authored-By: Codex <noreply@openai.com>
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Performance
- Use RGB_565 when alpha is unnecessary ([#5821](https://github.com/getsentry/sentry-java/pull/5821))If none of the above apply, you can opt out of this check by adding |
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| fab3793 | 330.67 ms | 352.10 ms | 21.43 ms |
| fcda53a | 318.75 ms | 365.57 ms | 46.82 ms |
| 1976346 | 313.33 ms | 371.69 ms | 58.35 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| fab3793 | 0 B | 0 B | 0 B |
| fcda53a | 0 B | 0 B | 0 B |
| 1976346 | 0 B | 0 B | 0 B |
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.
📜 Description
Use
RGB_565for replay recording bitmaps when alpha is unnecessary. PixelCopy keepsARGB_8888when SurfaceView capture is enabled because compositing depends on the transparentholes left in the Window capture. Canvas capture always uses
RGB_565because it does not supportSurfaceView compositing.
This PR depends on #5808.
💡 Motivation and Context
RGB_565halves the recording bitmap's memory footprint. The previous switch toARGB_8888wasbased on an unconfirmed theory about native bitmap crashes; #5808 instead addresses the concurrent
PixelCopy access and recycling that can produce those crashes.
Refs #5340
💚 How did you test it?
./gradlew ':sentry-android-replay:testDebugUnitTest' --tests='*PixelCopyStrategyTest*' --info./gradlew spotlessApply apiDumpAdded assertions that regular PixelCopy capture uses
RGB_565and SurfaceView capture retainsARGB_8888.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.