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

Function trackStringSplitCost

ext/strings.go:1071–1076  ·  view source on GitHub ↗

trackStringSplitCost tracks runtime cost for string split operations, accounting for traversal and list allocation.

(args []ref.Val, result ref.Val)

Source from the content-addressed store, hash-verified

1069// trackStringSplitCost tracks runtime cost for string split operations,
1070// accounting for traversal and list allocation.
1071func trackStringSplitCost(args []ref.Val, result ref.Val) *uint64 {
1072 traversalCost := float64(safeAdd(actualSize(args[0]), 1)) * stringCostFactor
1073 resultSize := actualSize(result)
1074 cost := safeAdd(callCost, uint64(math.Ceil(traversalCost)), resultSize, common.ListCreateBaseCost)
1075 return &cost
1076}
1077
1078// trackStringJoinCost tracks runtime cost for string join operations,
1079// accounting for traversal and the size of the result.

Callers

nothing calls this directly

Calls 2

safeAddFunction · 0.85
actualSizeFunction · 0.70

Tested by

no test coverage detected