Skip to content

BREAKING CHANGE: Revise default optimization level #1776

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

Merged
merged 4 commits into from
May 27, 2021
Merged

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Mar 31, 2021

Changes default optimization levels for --optimize respectively -O to optimizeLevel=3 and shrinkLevel=0 (was shrinkLevel=1), since -O3s, which was intended as a compromise, doesn't appear to be very useful in practice. Afterwards, -O is equivalent to -O3 respectively -Ospeed.

fixes #1753

  • I've read the contributing guidelines

@dcodeIO
Copy link
Member Author

dcodeIO commented Mar 31, 2021

Perhaps an agenda item for later today: Should the first bullet trigger a breaking change? If so, I'd probably split this.

@dcodeIO dcodeIO requested review from MaxGraey and torch2424 March 31, 2021 09:03
cli/asc.json Outdated
"-O3z": { "value": { "optimizeLevel": 3, "shrinkLevel": 2 } }
"-O3z": { "value": { "optimizeLevel": 3, "shrinkLevel": 2 } },
"-Ospeed": { "value": { "optimizeLevel": 3, "shrinkLevel": 0 } },
"-Osize": { "value": { "optimizeLevel": 0, "shrinkLevel": 2, "converge": true } }
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, does optimizeLevel: 0 really beter than optimizeLevel: 3 for size shrinking?

Copy link
Member Author

Choose a reason for hiding this comment

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

Would assume it depends. If there is a lot that can be inlined for example, it would depend on how well it optimizes away afterwards. If it doesn't, not inlining in the first place may be better.

Copy link
Member Author

Choose a reason for hiding this comment

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

The std/array test produces exactly the same binary size with both -O3z and -Oz. The bootstrapped compiler seems to have a difference of a couple bytes: 838.188 with -O3z vs 838.155 with -Oz.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Thanks for info!

Copy link
Contributor

@torch2424 torch2424 left a comment

Choose a reason for hiding this comment

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

Oh oops! I didn't realize I was a reviewer 😂

This looks great to me, as we discussed in the CG meeting. Again, thank you so much for this! 😄 🙏

@torch2424
Copy link
Contributor

Oh! And I think we discussed in the CG meeting, that we might want to make this PR breaking. Or, split out the non-breaking flag changes into another PR. And then make this one as a part of whatever the next breaking change is? 😄

@dcodeIO dcodeIO changed the title Revise optimization levels and add shorthands for speed and size Revise default optimization level Apr 1, 2021
@dcodeIO dcodeIO changed the title Revise default optimization level BREAKING CHANGE: Revise default optimization level May 27, 2021
@dcodeIO dcodeIO merged commit e3d5631 into master May 27, 2021
@dcodeIO dcodeIO deleted the issue-1753 branch June 1, 2021 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve and add new --optimize flags for the AssemblyScript Compiler
3 participants