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 generated code via the CLI by default #973

Merged
merged 3 commits into from
Feb 24, 2020

Conversation

alexcrichton
Copy link
Member

This commit updates the behavior of the CLI and adds a new flag. It
first enables the --optimize flag by default, ensuring that usage of
the wasmtime CLI will enable cranelift optimizations by default. Next
it also adds a --opt-level flag which is similar to Rust's
-Copt-level where it takes a string argument of how to optimize. This
is updates to support 0/1/2/s, where 1 is currently the same as 2 but
added for consistency with other compilers. The default setting is
--opt-level=2.

When the -O flag is not passed the --opt-level flag is used,
otherwise -O takes precedent in the sense that it implies
--opt-level=2 which is the highest optimization level. The thinking is
that these flags will in general select the highest optimization level
specified as the final optimization level.

This commit updates the behavior of the CLI and adds a new flag. It
first enables the `--optimize` flag by default, ensuring that usage of
the `wasmtime` CLI will enable cranelift optimizations by default. Next
it also adds a `--opt-level` flag which is similar to Rust's
`-Copt-level` where it takes a string argument of how to optimize. This
is updates to support 0/1/2/s, where 1 is currently the same as 2 but
added for consistency with other compilers. The default setting is
`--opt-level=2`.

When the `-O` flag is not passed the `--opt-level` flag is used,
otherwise `-O` takes precedent in the sense that it implies
`--opt-level=2` which is the highest optimization level. The thinking is
that these flags will in general select the highest optimization level
specified as the final optimization level.
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
Copy link
Member

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

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

Just the above comment regarding the help text.

@peterhuene
Copy link
Member

Looks like a test needs updating given the new signature for compile_to_obj.

@alexcrichton alexcrichton merged commit d4fcd32 into bytecodealliance:master Feb 24, 2020
@alexcrichton alexcrichton deleted the default-optimize branch February 24, 2020 21:18
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

Successfully merging this pull request may close these issues.

3 participants