()
| 318 | } |
| 319 | |
| 320 | func newList() []uint64 { |
| 321 | var l []uint64 |
| 322 | max := int64(N) * 1000 |
| 323 | for i := 0; i < N; i++ { |
| 324 | l = append(l, uint64(rand.Int63n(max))) |
| 325 | } |
| 326 | sort.Slice(l, func(i, j int) bool { |
| 327 | return l[i] < l[j] |
| 328 | }) |
| 329 | out := l[:0] |
| 330 | var last uint64 |
| 331 | for _, x := range l { |
| 332 | if x == last { |
| 333 | continue |
| 334 | } |
| 335 | last = x |
| 336 | out = append(out, x) |
| 337 | } |
| 338 | return out |
| 339 | } |
| 340 | |
| 341 | // This is taking 16ms. Clone itself takes ~4ms. So, ~12ms for AND. |
| 342 | func BenchmarkAnd(b *testing.B) { |