Skip to main content

is_negative_cost

Function is_negative_cost 

Source
pub fn is_negative_cost(id: ScalarFnId) -> bool
Expand description

A scalar function has a negative cost if applying it to an array and canonicalizing is cheaper than canonicalizing an array and applying it.

Example of negative cost expressions are byte_length(), ext_storage(), and get_item() since they don’t depend on input size.

Example of non-negative cost expression is like() as it’s linear over individual input.