pub struct OptimizationConfig { /* private fields */ }Expand description
A live choice of which optimizations are enabled — one bit per Opt.
The default is every optimization on (the speed-tuned baseline). Clearing all bits yields plain, boring Rust.
Implementations§
Source§impl OptimizationConfig
impl OptimizationConfig
Sourcepub fn enable_with_requires(&mut self, opt: Opt)
pub fn enable_with_requires(&mut self, opt: Opt)
Turn opt on together with the transitive closure of what it requires.
The complement of normalize’s dependency-closure
(which turns dependents off when a requirement goes off): enabling a
leaf must pull its whole requires-chain on, or normalize would just turn
the leaf back off. This is the on-direction of the UI’s toggle-linking.
Sourcepub const fn is_all_off(&self) -> bool
pub const fn is_all_off(&self) -> bool
Whether every optimization is off.
Sourcepub const fn bits(&self) -> u64
pub const fn bits(&self) -> u64
The raw enabled bitmask (bit layout = Opt::bit). Lets callers relate
an OptimizationConfig to a FiredOptimizations set bit-for-bit.
Sourcepub const fn merged(&self, func: &OptimizationConfig) -> OptimizationConfig
pub const fn merged(&self, func: &OptimizationConfig) -> OptimizationConfig
Combine a program-level config with a function’s per-function overrides: an optimization is on for the function only if it is on in both.
Sourcepub fn disabled_keywords(&self) -> impl Iterator<Item = &'static str> + '_
pub fn disabled_keywords(&self) -> impl Iterator<Item = &'static str> + '_
The keywords of every optimization currently off (registry order).
Sourcepub fn normalize(&mut self) -> NormalizeReport
pub fn normalize(&mut self) -> NormalizeReport
Resolve conflicts and dependencies, returning what was auto-disabled.
Conflicts: when two mutually exclusive optimizations are both on, the
one declared earlier in REGISTRY wins and the later is disabled.
Dependencies: any optimization whose requires set is not fully on is
disabled (transitively, to a fixed point).
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Build a config from the environment, the single external entry point.
LOGOS_OPT=off(orLOGOS_NO_OPTIMIZE=1) disables everything.LOGOS_OPT_PROFILE=speed|memory|safetyselects a base profile.LOGOS_OPT_OFF="scalarize,unroll,…"disables the listed keywords.
The result is normalized.
Sourcepub fn from_spec(
master_off: bool,
profile: Option<&str>,
off_list: Option<&str>,
) -> Self
pub fn from_spec( master_off: bool, profile: Option<&str>, off_list: Option<&str>, ) -> Self
The pure, testable core of from_env. master_off disables everything;
profile picks the base preset (speed by default); off_list is a
comma/space/;-separated list of keywords to disable. The result is
normalized.
Trait Implementations§
Source§impl Clone for OptimizationConfig
impl Clone for OptimizationConfig
Source§fn clone(&self) -> OptimizationConfig
fn clone(&self) -> OptimizationConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more