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

Function trackStringCharAtCost

ext/strings.go:1032–1036  ·  view source on GitHub ↗

Runtime cost tracking functions for string extensions. These functions compute the actual cost of string operations after evaluation, using the real sizes of the inputs and outputs. trackStringCharAtCost tracks runtime cost for O(n) string operations.

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

Source from the content-addressed store, hash-verified

1030
1031// trackStringCharAtCost tracks runtime cost for O(n) string operations.
1032func trackStringCharAtCost(args []ref.Val, result ref.Val) *uint64 {
1033 size := float64(actualSize(args[0])) * stringCostFactor
1034 cost := safeAdd(callCost, uint64(math.Ceil(size)), 1)
1035 return &cost
1036}
1037
1038// trackStringTransformCost tracks runtime cost for O(n) string operations.
1039func trackStringTransformCost(args []ref.Val, result ref.Val) *uint64 {

Callers

nothing calls this directly

Calls 2

safeAddFunction · 0.85
actualSizeFunction · 0.70

Tested by

no test coverage detected