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

Add custom Fresco decoder for binary XML #46711

Closed
wants to merge 1 commit into from

Conversation

Abbondanzo
Copy link
Contributor

@Abbondanzo Abbondanzo commented Sep 27, 2024

Summary

Vector drawable decompression is a blocking operation and can sometimes take upwards of 20-30ms per image, especially if that vector drawable uses complex colors. Less complex vector drawables still take several milliseconds to decompress and are served from a cache on later load attempts.

Here's a list of all the load times of vector drawable images in FB:
image

This diff aims to shift decompression to one of Fresco's decode threads, off the main thread, so we don't block while waiting for decompression operations to complete. This relies on adding a new custom decoder that reads the header of XML binary and converts encoded image requests to drawable objects that are yielded from the new XmlDrawableFactory.

It's important to note that this change does not stop ReactImageView from loading XML-based drawables on the main thread, it merely offers a new mechanism for loading them.

Changelog

[Android][Added] - Add a new Fresco decoder for XML resource types

Differential Revision: D63476283

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Sep 27, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476283

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476283

Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Sep 30, 2024
Summary:
Pull Request resolved: facebook#46711

## Summary
Vector drawable decompression is a blocking operation and can sometimes take upwards of 20-30ms per image, especially if that vector drawable uses complex colors. Less complex vector drawables still take several milliseconds to decompress and are served from a cache on later load attempts.

Here's a list of all the load times of vector drawable images in FBVR:
 {F1891592104}

This diff aims to shift decompression to one of Fresco's decode threads, off the main thread, so we don't block while waiting for decompression operations to complete. This relies on adding a new custom decoder that reads the header of XML binary and converts encoded image requests to drawable objects that are yielded from the new `XmlDrawableFactory`.

It's important to note that this change does not stop `ReactImageView` from loading XML-based drawables on the main thread, it merely offers a new mechanism for loading them.

## Changelog
[Android][Added] - Add a new Fresco decoder for XML resource types

Differential Revision: D63476283
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476283

Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Sep 30, 2024
Summary:
Pull Request resolved: facebook#46711

## Summary
Vector drawable decompression is a blocking operation and can sometimes take upwards of 20-30ms per image, especially if that vector drawable uses complex colors. Less complex vector drawables still take several milliseconds to decompress and are served from a cache on later load attempts.

Here's a list of all the load times of vector drawable images in FBVR:
 {F1891592104}

This diff aims to shift decompression to one of Fresco's decode threads, off the main thread, so we don't block while waiting for decompression operations to complete. This relies on adding a new custom decoder that reads the header of XML binary and converts encoded image requests to drawable objects that are yielded from the new `XmlDrawableFactory`.

It's important to note that this change does not stop `ReactImageView` from loading XML-based drawables on the main thread, it merely offers a new mechanism for loading them.

## Changelog
[Android][Added] - Add a new Fresco decoder for XML resource types

Differential Revision: D63476283
@Abbondanzo Abbondanzo force-pushed the export-D63476283 branch 2 times, most recently from 5eed176 to 9285846 Compare October 1, 2024 18:12
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Oct 1, 2024
Summary:
Pull Request resolved: facebook#46711

## Summary
Vector drawable decompression is a blocking operation and can sometimes take upwards of 20-30ms per image, especially if that vector drawable uses complex colors. Less complex vector drawables still take several milliseconds to decompress and are served from a cache on later load attempts.

Here's a list of all the load times of vector drawable images in FBVR:
 {F1891592104}

This diff aims to shift decompression to one of Fresco's decode threads, off the main thread, so we don't block while waiting for decompression operations to complete. This relies on adding a new custom decoder that reads the header of XML binary and converts encoded image requests to drawable objects that are yielded from the new `XmlDrawableFactory`.

It's important to note that this change does not stop `ReactImageView` from loading XML-based drawables on the main thread, it merely offers a new mechanism for loading them.

## Changelog
[Android][Added] - Add a new Fresco decoder for XML resource types

Reviewed By: javache

Differential Revision: D63476283
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476283

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476283

Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Oct 2, 2024
Summary:
Pull Request resolved: facebook#46711

## Summary
Vector drawable decompression is a blocking operation and can sometimes take upwards of 20-30ms per image, especially if that vector drawable uses complex colors. Less complex vector drawables still take several milliseconds to decompress and are served from a cache on later load attempts.

Here's a list of all the load times of vector drawable images in FBVR:
 {F1891592104}

This diff aims to shift decompression to one of Fresco's decode threads, off the main thread, so we don't block while waiting for decompression operations to complete. This relies on adding a new custom decoder that reads the header of XML binary and converts encoded image requests to drawable objects that are yielded from the new `XmlDrawableFactory`.

It's important to note that this change does not stop `ReactImageView` from loading XML-based drawables on the main thread, it merely offers a new mechanism for loading them.

## Changelog
[Android][Added] - Add a new Fresco decoder for XML resource types

Differential Revision: D63476283
Summary:

## Summary
Vector drawable decompression is a blocking operation and can sometimes take upwards of 20-30ms per image, especially if that vector drawable uses complex colors. Less complex vector drawables still take several milliseconds to decompress and are served from a cache on later load attempts.

Here's a list of all the load times of vector drawable images in FBVR:
 {F1891592104} 

This diff aims to shift decompression to one of Fresco's decode threads, off the main thread, so we don't block while waiting for decompression operations to complete. This relies on adding a new custom decoder that reads the header of XML binary and converts encoded image requests to drawable objects that are yielded from the new `XmlDrawableFactory`.

It's important to note that this change does not stop `ReactImageView` from loading XML-based drawables on the main thread, it merely offers a new mechanism for loading them.

## Changelog
[Android][Added] - Add a new Fresco decoder for XML resource types

Reviewed By: mdvacca

Differential Revision: D63476283
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476283

Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Oct 3, 2024
Summary:

## Summary
Vector drawable decompression is a blocking operation and can sometimes take upwards of 20-30ms per image, especially if that vector drawable uses complex colors. Less complex vector drawables still take several milliseconds to decompress and are served from a cache on later load attempts.

Here's a list of all the load times of vector drawable images in FBVR:
 {F1891592104} 

This diff aims to shift decompression to one of Fresco's decode threads, off the main thread, so we don't block while waiting for decompression operations to complete. This relies on adding a new custom decoder that reads the header of XML binary and converts encoded image requests to drawable objects that are yielded from the new `XmlDrawableFactory`.

It's important to note that this change does not stop `ReactImageView` from loading XML-based drawables on the main thread, it merely offers a new mechanism for loading them.

## Changelog
[Android][Added] - Add a new Fresco decoder for XML resource types

Reviewed By: mdvacca

Differential Revision: D63476283
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Oct 3, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 118b7c1.

@Abbondanzo Abbondanzo deleted the export-D63476283 branch October 11, 2024 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants