stringSubstringRangeCostModel models s.substring(start, end): the result has end - start code points, sized between that length and 4 times it under the aggregate strategy, and never above the remaining suffix of the receiver.
(id string)
| 954 | // points, sized between that length and 4 times it under the aggregate strategy, and never above |
| 955 | // the remaining suffix of the receiver. |
| 956 | func stringSubstringRangeCostModel(id string) cost.OverloadModel { |
| 957 | length := cost.Sub(cost.IntArg(1, 0), cost.IntArg(0, 0)) |
| 958 | return cost.MemberOverload(id, |
| 959 | stringTransformEvalCost(), |
| 960 | cost.ResultSize(cost.Ranged( |
| 961 | length, |
| 962 | cost.Min(cost.Sub(cost.Target(), cost.IntArg(0, 0)), cost.Scale(length, 4)), |
| 963 | )), |
| 964 | cost.BeforeVersion(1, cost.ManualEstimator(estimateSubstringCost)), |
| 965 | ) |
| 966 | } |
| 967 | |
| 968 | // listJoinCostModel models l.join(): it reads the list once and builds the concatenated result. |
| 969 | func listJoinCostModel(id string) cost.OverloadModel { |
no test coverage detected