RUM-10346: Avoid copying hardware bitmap in Session Replay#2732
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2732 +/- ##
===========================================
- Coverage 69.83% 69.76% -0.07%
===========================================
Files 824 824
Lines 30774 30791 +17
Branches 5173 5177 +4
===========================================
- Hits 21489 21479 -10
- Misses 7823 7850 +27
Partials 1462 1462
🚀 New features to boost your workflow:
|
ambushwork
marked this pull request as ready for review
June 17, 2025 08:42
Contributor
|
Didn't we stop copying bitmap in main thread in this pr? |
Member
Author
That PR is the fix for copying the drawable, it only applies to Android classic view since we can't access to drawable directly in Jetpack Compose, This PR fixes the bitmap copy issue when we retrieve the bitmap by using reflection in Jetpack Compose. |
0xnm
previously approved these changes
Jun 17, 2025
aleksandr-gringauz
previously approved these changes
Jun 17, 2025
ambushwork
force-pushed
the
yl/sr/avoid-copying-hardware-bitmap
branch
from
June 17, 2025 12:11
4675f58 to
d99bf3a
Compare
ambushwork
force-pushed
the
yl/sr/avoid-copying-hardware-bitmap
branch
from
June 17, 2025 12:22
d99bf3a to
4edd2af
Compare
0xnm
reviewed
Jun 17, 2025
ambushwork
force-pushed
the
yl/sr/avoid-copying-hardware-bitmap
branch
from
June 17, 2025 12:39
4edd2af to
1b2f389
Compare
0xnm
approved these changes
Jun 17, 2025
ambushwork
force-pushed
the
yl/sr/avoid-copying-hardware-bitmap
branch
from
June 17, 2025 14:05
1b2f389 to
821b386
Compare
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.
What does this PR do?
In Session Replay especially for Jetpack Compose, we are copying the original bitmap before compressing and transforming it into byte data on work thread in case that the original one is recycled.
But copying hardware bitmap can be very slow especially we are doing it on main thread. With some manual test we noticed that the average copy time of software bitmap is around 30~60us, and for hardware bitmap it can be up to 10~20ms. And it throws strict mode warning if client enables it in their app.
So in this PR we decide to skip hardware bitmap copying, passing the original instance until the byte data processing, if it is recycled during the time, then we skip it by reporting it to telemetry.
Motivation
RUM-10346:
Review checklist (to be filled by reviewers)