stringSubstringCostModel models s.substring(start): it drops at least start units of the receiver, and at most 4 times as many under the aggregate strategy (where each code point takes 1 to 4 UTF-8 bytes).
(id string)
| 940 | // receiver, and at most 4 times as many under the aggregate strategy (where each code point takes |
| 941 | // 1 to 4 UTF-8 bytes). |
| 942 | func stringSubstringCostModel(id string) cost.OverloadModel { |
| 943 | return cost.MemberOverload(id, |
| 944 | stringTransformEvalCost(), |
| 945 | cost.ResultSize(cost.Ranged( |
| 946 | cost.Sub(cost.Target(), cost.Scale(cost.IntArg(0, 0), 4)), |
| 947 | cost.Sub(cost.Target(), cost.IntArg(0, 0)), |
| 948 | )), |
| 949 | cost.BeforeVersion(1, cost.ManualEstimator(estimateSubstringCost)), |
| 950 | ) |
| 951 | } |
| 952 | |
| 953 | // stringSubstringRangeCostModel models s.substring(start, end): the result has end - start code |
| 954 | // points, sized between that length and 4 times it under the aggregate strategy, and never above |
no test coverage detected