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

Function estimateStringVariableTransformCost

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

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