MCPcopy Create free account
hub / github.com/cel-expr/cel-go / listDistinctCostModel

Function listDistinctCostModel

ext/lists.go:1257–1263  ·  view source on GitHub ↗

listDistinctCostModel models l.distinct(): it compares every pair of elements. Its tracker raises the factor for string and bytes elements, which a model of the single list(dyn) overload cannot see, so the model charges the larger factor. The result holds some of the receiver's elements, and at leas

(id string, legacy bool)

Source from the content-addressed store, hash-verified

1255// cannot see, so the model charges the larger factor. The result holds some of the receiver's
1256// elements, and at least one when the receiver has any.
1257func listDistinctCostModel(id string, legacy bool) cost.OverloadModel {
1258 return cost.MemberOverload(id,
1259 cost.EvalCost(selfCompareCost(cost.Length(cost.Target()), 2+cost.StringTraversalCostFactor)),
1260 cost.ResultSize(cost.Ranged(cost.Min(cost.Target(), cost.Const(1)), cost.Target())),
1261 cost.BeforeVersion(1, cost.ManualCost(estimateListDistinct(legacy), trackListSelfCompare(0))),
1262 )
1263}
1264
1265// flattenedSize bounds the size of l.flatten(), sound under both built-in strategies. Its upper
1266// bound is the smaller of two bounds:

Callers 1

CompileOptionsMethod · 0.85

Calls 13

MemberOverloadFunction · 0.92
EvalCostFunction · 0.92
LengthFunction · 0.92
TargetFunction · 0.92
ResultSizeFunction · 0.92
RangedFunction · 0.92
MinFunction · 0.92
ConstFunction · 0.92
BeforeVersionFunction · 0.92
ManualCostFunction · 0.92
selfCompareCostFunction · 0.85
estimateListDistinctFunction · 0.85

Tested by

no test coverage detected