Interface ConditionCostModel
Costs are relative values where lower numbers indicate cheaper operations. The absolute values don't matter - only their relative ordering affects optimization decisions.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintEstimates the relative cost of evaluating a condition.static ConditionCostModelCreates a default cost model that derives costs from function definitions.static ConditionCostModelcreateDefault(int nestedMultiplier) Creates a default cost model with a custom multiplier for nested functions.static ConditionCostModelCreate a cost model that assigns equal cost (1) to all conditions.
-
Method Details
-
createDefault
Creates a default cost model that derives costs from function definitions.This model uses
LibraryFunction.getFunctionDefinition()'s cost and applies a multiplier of 2 for nested function arguments.- Returns:
- a new default cost model
-
createUniform
Create a cost model that assigns equal cost (1) to all conditions.Use this when cost-based ordering should be disabled, allowing other factors (CFG structure, cone size, dependencies) to determine condition order exclusively.
- Returns:
- uniform cost model
-
createDefault
Creates a default cost model with a custom multiplier for nested functions.The cost of a condition is computed as:
cost = baseCost + sum(nestedFunctionCost * nestedMultiplier)
For example, with a multiplier of 2, the condition
isSet(parseUrl(endpoint))would have cost:10 + (200 * 2) = 410, reflecting that the expensive parseUrl must be evaluated before the cheap isSet can run.- Parameters:
nestedMultiplier- multiplier applied to nested function costs (typically 2-3)- Returns:
- a new cost model with the specified multiplier
-
cost
Estimates the relative cost of evaluating a condition.Lower values indicate cheaper operations that should be evaluated earlier when BDD structure permits.
- Parameters:
condition- the condition to evaluate- Returns:
- relative cost estimate (lower = cheaper)
-