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

Function listSortCostModels

ext/lists.go:1329–1348  ·  view source on GitHub ↗
(legacy bool)

Source from the content-addressed store, hash-verified

1327}
1328
1329func listSortCostModels(legacy bool) []cost.OverloadModel {
1330 models := make([]cost.OverloadModel, 0, 2*len(comparableTypes))
1331 for _, t := range comparableTypes {
1332 f := selfCompareFactor(t)
1333 models = append(models,
1334 cost.MemberOverload(fmt.Sprintf("list_%s_sort", t.TypeName()),
1335 cost.EvalCost(selfCompareCost(cost.Length(cost.Target()), f)),
1336 cost.ResultSize(cost.Target()),
1337 cost.BeforeVersion(1, cost.ManualCost(estimateListSort(t, legacy), trackListSelfCompare(0))),
1338 ),
1339 // sortBy compares the keys, and reorders the receiver.
1340 cost.MemberOverload(fmt.Sprintf("list_%s_sortByAssociatedKeys", t.TypeName()),
1341 cost.EvalCost(selfCompareCost(cost.Length(cost.Arg(0)), f)),
1342 cost.ResultSize(cost.Target()),
1343 cost.BeforeVersion(1, cost.ManualCost(estimateListSortBy(t, legacy), trackListSelfCompare(1))),
1344 ),
1345 )
1346 }
1347 return models
1348}
1349
1350func listSetOpCostModel(id string, costFactor float64) cost.OverloadModel {
1351 return cost.MemberOverload(id,

Callers 1

CompileOptionsMethod · 0.85

Calls 14

MemberOverloadFunction · 0.92
EvalCostFunction · 0.92
LengthFunction · 0.92
TargetFunction · 0.92
ResultSizeFunction · 0.92
BeforeVersionFunction · 0.92
ManualCostFunction · 0.92
ArgFunction · 0.92
selfCompareFactorFunction · 0.85
selfCompareCostFunction · 0.85
estimateListSortFunction · 0.85
trackListSelfCompareFunction · 0.85

Tested by

no test coverage detected