Optimize Adding Dirty Indices (#13660)

* add it in

* add in test

* potuz's review
This commit is contained in:
Nishant Das
2024-02-24 18:08:17 +08:00
committed by GitHub
parent 70e1b11aeb
commit 1d5a09c05d
3 changed files with 28 additions and 2 deletions

View File

@@ -94,7 +94,7 @@ func UnionUint64(s ...[]uint64) []uint64 {
// values from the provided list of indices.
func SetUint64(a []uint64) []uint64 {
// Remove duplicates indices.
intMap := map[uint64]bool{}
intMap := make(map[uint64]bool, len(a))
cleanedIndices := make([]uint64, 0, len(a))
for _, idx := range a {
if intMap[idx] {