Enum OptLevel Copy item path Source pub enum OptLevel {
O0,
O1,
O2,
O3,
Os,
Oz,
}Expand description An optimisation level.
spec/16-performance.md section 16.4 gives each level a throughput budget and a code
quality budget, and the levels exist to make that tradeoff explicit rather than to be a
dial. There is no -O4, because a level nobody can state the contract for is a level
nobody can test.
-O0. Compile as fast as possible and keep every variable inspectable.
-O1. The cheap wins, at roughly the cost of -O0.
-O2. The full pipeline. This is the level the code quality claim is about.
-O3. -O2 plus the transformations that trade size for speed.
-Os. Optimise for size, at roughly -O2 compile time.
-Oz. Optimise for size, aggressively.
The flag that selects this level.
Whether this level optimises for size rather than speed.
Whether the middle end runs at all.
Whether the instructions of a block are put in the order the machine finishes soonest.
spec/optimizer/38-scheduling-and-layout.md section 38.6 says -O2 and above, and gcc
turns -fschedule-insns2 on at the two size levels as well, which costs nothing: a
schedule is a permutation of instructions that were all going to be written anyway, so it
is the one optimization here that cannot make a function larger.
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Returns the “default value” for a type.
Read more Formats the value using the given formatter.
Read more Parses the part after -O, so "" is -O which GCC treats as -O1.
The associated error which can be returned from parsing.
Compares and returns the maximum of two values.
Read more Compares and returns the minimum of two values.
Read more Restrict a value to a certain interval.
Read more 🔬 This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range.
Read more This method returns an ordering between
self and
other values if one exists.
Read more Tests less than (for
self and
other) and is used by the
< operator.
Read more Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more Tests greater than (for
self and
other) and is used by the
>
operator.
Read more Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more Converts the given value to a
String.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.