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

Function trackStringTransformCost

ext/strings.go:1039–1044  ·  view source on GitHub ↗

trackStringTransformCost tracks runtime cost for O(n) string operations.

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

Source from the content-addressed store, hash-verified

1037
1038// trackStringTransformCost tracks runtime cost for O(n) string operations.
1039func trackStringTransformCost(args []ref.Val, result ref.Val) *uint64 {
1040 transformCost := math.Ceil(float64(actualSize(args[0])) * stringCostFactor)
1041 resultSize := actualSize(result)
1042 cost := safeAdd(callCost, uint64(transformCost), resultSize)
1043 return &cost
1044}
1045
1046// trackStringSearchCost tracks runtime cost for O(n*m) string search operations.
1047func trackStringSearchCost(args []ref.Val, _ ref.Val) *uint64 {

Callers

nothing calls this directly

Calls 2

safeAddFunction · 0.85
actualSizeFunction · 0.70

Tested by

no test coverage detected