| 1111 | } |
| 1112 | |
| 1113 | boundary := n - 4 |
| 1114 | breakpoints := mapset.NewSet[int]() |
| 1115 | for point := range state.CacheBreakPoints.Iter() { |
| 1116 | if point >= 0 && point < boundary { |
| 1117 | breakpoints.Add(point) |
| 1118 | } |
| 1119 | } |
| 1120 | const maxHistoryBreakpoints = 2 |
| 1121 | if breakpoints.Cardinality() < maxHistoryBreakpoints { |
| 1122 | candidates := []int{} |
| 1123 | if n >= 12 { |
| 1124 | candidates = append(candidates, max(n/3, 2)) |
| 1125 | } |
| 1126 | if n >= 18 { |
| 1127 | candidates = append(candidates, max((2*n)/3, (n/3)+5)) |
| 1128 | } |
| 1129 | for _, candidate := range candidates { |
| 1130 | if breakpoints.Cardinality() >= maxHistoryBreakpoints { |
| 1131 | break |