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

Function estimateStringVariableTransformCost

ext/strings.go:913–920  ·  view source on GitHub ↗

estimateStringVariableTransformCost estimates cost for O(n) string operations that result in a variable sized string which may be empty to the exact input string.

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

Source from the content-addressed store, hash-verified

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.
913func estimateStringVariableTransformCost(estimator checker.CostEstimator, target *checker.AstNode, args []checker.AstNode) *checker.CallEstimate {
914 if target == nil {
915 return nil
916 }
917 cost, size := estimateStringScan(estimateSize(estimator, *target))
918 transformSize := rangedSizeEstimate(0, size.Max)
919 return callEstimate(cost.Add(callCostEstimate).Add(transformSize.AsCost()), &transformSize)
920}
921
922// estimateStringCharAtCost includes a cost of 1 for the allocation, plus the string traversal cost.
923func estimateStringCharAtCost(estimator checker.CostEstimator, target *checker.AstNode, args []checker.AstNode) *checker.CallEstimate {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected