listDistinctCostModel models l.distinct(): it compares every pair of elements. Its tracker raises the factor for string and bytes elements, which a model of the single list(dyn) overload cannot see, so the model charges the larger factor. The result holds some of the receiver's elements, and at leas
(id string, legacy bool)
| 1255 | // cannot see, so the model charges the larger factor. The result holds some of the receiver's |
| 1256 | // elements, and at least one when the receiver has any. |
| 1257 | func listDistinctCostModel(id string, legacy bool) cost.OverloadModel { |
| 1258 | return cost.MemberOverload(id, |
| 1259 | cost.EvalCost(selfCompareCost(cost.Length(cost.Target()), 2+cost.StringTraversalCostFactor)), |
| 1260 | cost.ResultSize(cost.Ranged(cost.Min(cost.Target(), cost.Const(1)), cost.Target())), |
| 1261 | cost.BeforeVersion(1, cost.ManualCost(estimateListDistinct(legacy), trackListSelfCompare(0))), |
| 1262 | ) |
| 1263 | } |
| 1264 | |
| 1265 | // flattenedSize bounds the size of l.flatten(), sound under both built-in strategies. Its upper |
| 1266 | // bound is the smaller of two bounds: |
no test coverage detected