Skip to content

Commit 4994e55

Browse files
author
buck heroux
committed
index: seen map
1 parent 2653ba4 commit 4994e55

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

index.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,14 @@ func (idx *SuffixIndex) TileRange(zmin, zmax int) <-chan Tile {
138138
tiles := make(chan Tile, 1<<10)
139139
go func() {
140140
defer close(tiles)
141+
seen := make(map[Tile]struct{}, len(idx.tiles)*(zmax-zmin+1))
141142
for k := range idx.tiles {
142143
for z := zmin; z <= zmax; z++ {
143-
tiles <- k[:z].ToTile()
144+
t := k[:z].ToTile()
145+
if _, ok := seen[t]; !ok {
146+
tiles <- t
147+
seen[t] = struct{}{}
148+
}
144149
}
145150
}
146151
}()

0 commit comments

Comments
 (0)