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

Function estimateStringFixedTransformCost

ext/strings.go:903–909  ·  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

901// estimateStringFixedTransformCost estimates cost for O(n) string operations such as
902// lowerAscii, upperAsciil, reverse and quote.
903func estimateStringFixedTransformCost(estimator checker.CostEstimator, target *checker.AstNode, args []checker.AstNode) *checker.CallEstimate {
904 if target == nil {
905 return nil
906 }
907 cost, size := estimateStringScan(estimateSize(estimator, *target))
908 return callEstimate(cost.Add(callCostEstimate).Add(size.AsCost()), size)
909}
910
911// estimateStringVariableTransformCost estimates cost for O(n) string operations that result
912// 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