Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

Reland 2 (part 1): Enforce the rule of calling FlutterView.Render #47062

Merged
merged 3 commits into from
Oct 18, 2023

Conversation

dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Oct 18, 2023

This PR relands part of #45300, which was reverted in #46919 due to performance regression.

Due to how little and trivial production code the original PR touches, I really couldn't figure out the exact line that caused it except through experimentation, which requires changes to be officially landed on the main branch. After this PR lands, I'll immediately fire a performance test.

This PR contains the Shell refactor of the original PR. I made a slight change where the isolate snapshot is no longer returned through return value, but the parameter, in order to avoid the overhead of assigning.

It is intentional to not contain any unit tests or other changes of the original PR. They will be landed shortly after this PR.

Part of flutter/flutter#136826.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • 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.
  • 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 ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

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 Hixie or stuartmorgan on 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.

@dkwingsmt dkwingsmt requested a review from loic-sharma October 18, 2023 17:18
@loic-sharma
Copy link
Member

I made a slight change where the isolate snapshot is no longer returned through return value, but the parameter, in order to avoid the overhead of assigning.

I find the original PR's approach of returning an std::pair to be clearer than modifying a parameter. Why is the overhead of assigning the isolate snapshot expensive? Was the original PR copying the isolate snapshot?

@dkwingsmt
Copy link
Contributor Author

dkwingsmt commented Oct 18, 2023

The original PR shouldn't be copying the isolate.

Personally, I can't see any places in the original PR that should have such a big impact on performance. So I'll have to experiment. If it turns out eventually that nothing else affects the performance, I can try to land this line back.

@loic-sharma
Copy link
Member

loic-sharma commented Oct 18, 2023

It seems you cannot copy the snapshot. Could we go back to the original std::pair approach? Or what concerns block that?

@dkwingsmt
Copy link
Contributor Author

@loic-sharma Done!

Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

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

LGTM

@dkwingsmt dkwingsmt merged commit 340fc37 into flutter:main Oct 18, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 18, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 18, 2023
…136846)

flutter/engine@b67edb0...8d51b64

2023-10-18 skia-flutter-autoroll@skia.org Roll Skia from d46a3697d3c5 to d561b276b5d9 (1 revision) (flutter/engine#47074)
2023-10-18 skia-flutter-autoroll@skia.org Roll Dart SDK from b423d5753fdc to d9b1e60fe442 (1 revision) (flutter/engine#47073)
2023-10-18 dkwingsmt@users.noreply.github.com Reland 2 (part 1): Enforce the rule of calling `FlutterView.Render` (flutter/engine#47062)
2023-10-18 skia-flutter-autoroll@skia.org Roll Skia from ef0e93524e7d to d46a3697d3c5 (2 revisions) (flutter/engine#47072)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jimgraham@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@dkwingsmt
Copy link
Contributor Author

The performance test after landing this PR to google3 shows no regression (447 after PR vs 463 before PR). Consider this PR safe.

@dkwingsmt dkwingsmt deleted the reland-shell-infer branch October 19, 2023 06:22
auto-submit bot pushed a commit that referenced this pull request Oct 19, 2023
…47095)

This PR relands part of #45300, which was reverted in #46919 due to performance regression.

Due to how little and trivial production code the original PR touches, I really couldn't figure out the exact line that caused it except through experimentation, which requires changes to be officially landed on the main branch. After this PR lands, I'll immediately fire a performance test.

This PR contains the render rule check performed by `PlatformDispatcher` of the original PR, the remaining changes to production code besides [the part 1](#47062). Since part 1 shows no regression, the changes of this PR is highly likely to be the culprit. Therefore I made some changes: The rule enforcement is no longer performed in release mode, but only in debug mode. This will cause behavior deviation between builds, but since the developer should be able to notice violation in debug mode anyway, I think this design is acceptable.

It is intentional to not contain any unit tests or other changes of the original PR. They will be landed shortly after this PR.

Part of flutter/flutter#136826.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
@dkwingsmt dkwingsmt mentioned this pull request Oct 19, 2023
8 tasks
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
…47062)

This PR relands part of #45300,
which was reverted in #46919 due
to performance regression.

Due to how little and trivial production code the original PR touches, I
really couldn't figure out the exact line that caused it except through
experimentation, which requires changes to be officially landed on the
main branch. After this PR lands, I'll immediately fire a performance
test.

This PR contains the `Shell` refactor of the original PR. I made a
slight change where the isolate snapshot is no longer returned through
return value, but the parameter, in order to avoid the overhead of
assigning.

It is intentional to not contain any unit tests or other changes of the
original PR. They will be landed shortly after this PR.

Part of flutter/flutter#136826.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] 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.
- [ ] 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 `///`).
- [ ] I signed the [CLA].
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
…47095)

This PR relands part of #45300, which was reverted in #46919 due to performance regression.

Due to how little and trivial production code the original PR touches, I really couldn't figure out the exact line that caused it except through experimentation, which requires changes to be officially landed on the main branch. After this PR lands, I'll immediately fire a performance test.

This PR contains the render rule check performed by `PlatformDispatcher` of the original PR, the remaining changes to production code besides [the part 1](#47062). Since part 1 shows no regression, the changes of this PR is highly likely to be the culprit. Therefore I made some changes: The rule enforcement is no longer performed in release mode, but only in debug mode. This will cause behavior deviation between builds, but since the developer should be able to notice violation in debug mode anyway, I think this design is acceptable.

It is intentional to not contain any unit tests or other changes of the original PR. They will be landed shortly after this PR.

Part of flutter/flutter#136826.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants