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

Function trackStringJoinCost

ext/strings.go:1080–1084  ·  view source on GitHub ↗

trackStringJoinCost tracks runtime cost for string join operations, accounting for traversal and the size of the result.

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

Source from the content-addressed store, hash-verified

1078// trackStringJoinCost tracks runtime cost for string join operations,
1079// accounting for traversal and the size of the result.
1080func trackStringJoinCost(args []ref.Val, result ref.Val) *uint64 {
1081 traversalCost := float64(safeAdd(actualSize(args[0]), 1)) * stringCostFactor
1082 cost := safeAdd(callCost, uint64(math.Ceil(traversalCost)), actualSize(result))
1083 return &cost
1084}

Callers

nothing calls this directly

Calls 2

safeAddFunction · 0.85
actualSizeFunction · 0.70

Tested by

no test coverage detected