Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize object return chaining #3215

Open
DesWurstes opened this issue Jan 26, 2019 · 2 comments
Open

Optimize object return chaining #3215

DesWurstes opened this issue Jan 26, 2019 · 2 comments

Comments

@DesWurstes
Copy link

a = a.b;
a = a.c;

can be optimized to

a = (a.b).c;

which is

a = a.b.c;
@DesWurstes DesWurstes changed the title Optimize object chaining Optimize object return chaining Jan 26, 2019
@ChadKillingsworth
Copy link
Collaborator

Any new compiler optimization has to provide either a substantial code size win (post gzip) or performance win. It's not clear to me that this would be either. Do you have real world examples of this pattern being used?

@ts-thomas
Copy link

At least it requires less chars for the same thing. This optimization is possibly a case which happens very often in the code, the sum of all might be noticeable smaller and faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants