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

Function estimateStringFixedTransformCost

ext/strings.go:904–910  ·  view source on GitHub ↗

Cost estimation functions for string extensions. These functions provide compile-time cost estimates proportional to the size of the input string(s), ensuring that the CEL cost system accurately reflects the computational work performed by string operations. estimateStringFixedTransformCost estimat

(estimator checker.CostEstimator, target *checker.AstNode, args []checker.AstNode)

Source from the content-addressed store, hash-verified

902// estimateStringFixedTransformCost estimates cost for O(n) string operations such as
903// lowerAscii, upperAsciil, reverse and quote.
904func estimateStringFixedTransformCost(estimator checker.CostEstimator, target *checker.AstNode, args []checker.AstNode) *checker.CallEstimate {
905 if target == nil {
906 return nil
907 }
908 cost, size := estimateStringScan(estimateSize(estimator, *target))
909 return callEstimate(cost.Add(callCostEstimate).Add(size.AsCost()), size)
910}
911
912// estimateStringVariableTransformCost estimates cost for O(n) string operations that result
913// in a variable sized string which may be empty to the exact input string.

Callers

nothing calls this directly

Calls 5

estimateStringScanFunction · 0.85
callEstimateFunction · 0.85
AsCostMethod · 0.80
estimateSizeFunction · 0.70
AddMethod · 0.65

Tested by

no test coverage detected