stringCharAtCostModel models charAt: it scans the receiver and returns a single code point, which is at most 4 UTF-8 bytes under the aggregate strategy and never above the receiver's size.
(id string)
| 909 | // stringCharAtCostModel models charAt: it scans the receiver and returns a single code point, which |
| 910 | // is at most 4 UTF-8 bytes under the aggregate strategy and never above the receiver's size. |
| 911 | func stringCharAtCostModel(id string) cost.OverloadModel { |
| 912 | return cost.MemberOverload(id, |
| 913 | cost.EvalCost(cost.Sum(cost.Const(cost.CallCost+1), cost.StringScan(cost.Length(cost.Target())))), |
| 914 | cost.ResultSize(cost.AtMost(cost.Min(cost.Target(), cost.Const(4)))), |
| 915 | cost.BeforeVersion(1, cost.ResultSize(cost.AtMost(cost.Const(1)))), |
| 916 | ) |
| 917 | } |
| 918 | |
| 919 | func stringSearchCostModel(id string) cost.OverloadModel { |
| 920 | return cost.MemberOverload(id, |
no test coverage detected