engine
engine copied to clipboard
Move `copyPixelsFromBuffer` to a background thread.
Move the time-consuming copyPixelsFromBuffer function to a background thread to avoid blocking the UI thread. At the same time, remove the unnecessary currentImage member.
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
- [ ] I listed at least one issue that this PR fixes in the description above.
- [x] I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with
///). - [x] I signed the CLA.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).
If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?
Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.
This PR is missing a detailed description of the changes and benchmarks associated with.
This PR is missing a detailed description of the changes and benchmarks associated with.
I'm not quite clear on how to include a benchmark. Would you mind offering some guidance? Thanks~
This PR is missing a detailed description of the changes and benchmarks associated with.
I'm not quite clear on how to include a benchmark. Would you mind offering some guidance? Thanks~
Since your making this change for performance reasons. I suggest you write a small program that allows you to measure/quantify how much time you save on the main UI thread? That is, a program that calls convertImageToBitmap with a bunch of different image sizes and measures how long it takes to complete.
That will give us an understanding of how impactful this change is.
We don't think this patch is safe to land, and lacking the benchmarks or evidence that it is faster and correct we don't plan to continue reviewing this.