Skip to content

Conversation

@ferhatb
Copy link
Contributor

@ferhatb ferhatb commented Feb 25, 2020

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
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.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@yjbanov
Copy link
Contributor

yjbanov commented Feb 26, 2020

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

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

vsmenon commented Feb 26, 2020

@rakudrama - on optimizability

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

@rakudrama
Copy link

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

@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