Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR] Reduce memory and disk consumption #4016

Merged
merged 26 commits into from
Jan 2, 2025
Merged

Conversation

romtsn
Copy link
Member

@romtsn romtsn commented Jan 2, 2025

📜 Description

Squeezed various improvements here to not open multiple PRs, but they are mostly around memory/allocations/size:

  • Reduce JPEG quality that we store to disk, it's also now part of the quality option, default is 30. This reduced the payload size even further and saved disk space up to ~40%. It's still of a good quality though for the end user, you can check this replay.
  • Change bitmap config from ARGB_8888 to RGB_565 as we don't really care about the alpha channel here.
  • Delete a frame screenshot if we were not able to decode it right away instead of trying to decode the file again and again.
  • Use only one bitmap as opposed to two + don't copy that one when passing it to replay cache - it's not necessary as we just flush its bytes to a file, but never recycle (only when the recording is stopped). It also works fine with multiple screenshots to the same bitmap, as PixelCopy would just overwrite it. Here's the resulting allocations (reduced the number of allocations and also the size by ~30%):

Before

Android Studio 2025-01-02 10 47 15

After

Android Studio 2025-01-02 10 21 01

💡 Motivation and Context

Part of getsentry/sentry#74441

💚 How did you test it?

Manually + automated

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

@romtsn romtsn changed the title Rz/fix/delete corrupted frames [SR] Reduce memory and disk consumption Jan 2, 2025
Copy link
Contributor

github-actions bot commented Jan 2, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 446.90 ms 467.26 ms 20.36 ms
Size 1.70 MiB 2.36 MiB 672.10 KiB

Copy link
Member

@stefanosiano stefanosiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@romtsn romtsn merged commit 90d524d into main Jan 2, 2025
32 of 33 checks passed
@romtsn romtsn deleted the rz/fix/delete-corrupted-frames branch January 2, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants