sdk icon indicating copy to clipboard operation
sdk copied to clipboard

`PropertyAccessorElementImpl`: optimize `name` getter to avoid calls to `considerCanonicalizeString`

Open gmpassos opened this issue 1 year ago • 3 comments

The name getter is a hotspot and shouldn't resolve String canonicalization for each call.


  • [✅] I’ve reviewed the contributor guide and applied the relevant portions to this PR.

gmpassos avatar Aug 21 '24 19:08 gmpassos

Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at:

https://dart-review.googlesource.com/c/sdk/+/381704

Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly.

Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR).

copybara-service[bot] avatar Aug 21 '24 19:08 copybara-service[bot]

https://dart-review.googlesource.com/c/sdk/+/381704 has been updated with the latest commits from this pull request.

copybara-service[bot] avatar Aug 22 '24 22:08 copybara-service[bot]

https://dart-review.googlesource.com/c/sdk/+/381704 has been updated with the latest commits from this pull request.

copybara-service[bot] avatar Aug 22 '24 22:08 copybara-service[bot]

@gmpassos what is the status of this change?

mraleph avatar Sep 11 '24 12:09 mraleph

https://dart-review.googlesource.com/c/sdk/+/381704 has been updated with the latest commits from this pull request.

copybara-service[bot] avatar Sep 11 '24 20:09 copybara-service[bot]

https://dart-review.googlesource.com/c/sdk/+/381704 has been updated with the latest commits from this pull request.

copybara-service[bot] avatar Sep 11 '24 20:09 copybara-service[bot]

@scheglov reviewed this and performed some benchmarks.

I plan to run additional benchmarks to demonstrate that this optimization is significant.

The key discussion is whether PropertyAccessorElementImpl should have an additional field to bypass considerCanonicalizeString.

IMHO, given the current level of optimization in the analyzer, achieving an extra 10% improvement will likely require accumulating several smaller optimizations, each contributing around 1%.

gmpassos avatar Sep 11 '24 20:09 gmpassos

https://dart-review.googlesource.com/c/sdk/+/381704 has been updated with the latest commits from this pull request.

copybara-service[bot] avatar Sep 17 '24 21:09 copybara-service[bot]

https://dart-review.googlesource.com/c/sdk/+/381704 has been updated with the latest commits from this pull request.

copybara-service[bot] avatar Sep 17 '24 21:09 copybara-service[bot]

@bwilkerson @scheglov please make a call if you want to accept or reject this PR and if you would like to accept submit corresponding CL to CQ (FWIW @bwilkerson has already voted +1).

mraleph avatar Sep 23 '24 11:09 mraleph