Skip to content

Reduce closure allocation in RenderObject.cleanRelayoutBoundary - #51439

Merged
ferhatb merged 1 commit into
flutter:masterfrom
ferhatb:rivet_framework_optim1
Feb 26, 2020
Merged

ferhatb merged 1 commit into
flutter:masterfrom
ferhatb:rivet_framework_optim1

Conversation

@ferhatb

@ferhatb ferhatb commented Feb 25, 2020

Copy link
Copy Markdown
Contributor

Description

Changes visitChildren closure allocation to use static method instead.

Related Issues

Discovered while profiling web EAP client project.

Tests

Covered by gallery benchmark.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

@ferhatb
ferhatb requested a review from yjbanov February 25, 2020 22:16
@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Feb 25, 2020
@fluttergithubbot

Copy link
Copy Markdown
Contributor

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.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@yjbanov

yjbanov commented Feb 26, 2020

Copy link
Copy Markdown
Contributor

/cc @vsmenon @sigmundch could this also be improved in the compiler?

@ferhatb
ferhatb merged commit 1a79592 into flutter:master Feb 26, 2020
@vsmenon

vsmenon commented Feb 26, 2020

Copy link
Copy Markdown
Contributor

@rakudrama - on optimizability

Non-trivial if compiler cannot identify whether visitChildren, etc rely on identity of the closure.

@rakudrama

Copy link
Copy Markdown
Contributor

This has been discussed at: dart-lang/sdk#26932
I'm prepared to break identity in optimizations - dart2js already GVNs repeated tear-offs which also have identity.

Since the language has evolved to have much richer static constraints (e.g. definite assignment is quite involved), I would advocate for a static definition of free variables and have the CFE hoist the functions.

@rakudrama

Copy link
Copy Markdown
Contributor

@leafpetersen How about updating the language spec so that closures with no free variables are more like static or top-level methods?

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants