MCPcopy Create free account
hub / github.com/egonelbre/exp / IterChan

Method IterChan

bench/sortedset/sortedset.go:75–96  ·  view source on GitHub ↗
(buf int)

Source from the content-addressed store, hash-verified

73}
74
75func (s *Set) IterChan(buf int) chan int {
76 vals := make(chan int, buf)
77 go func() {
78 j := 0
79 base := 0
80 df := 0
81 k := uint(0)
82 for _, b := range s.data {
83 df = df | (int(b&mask) << k)
84 k += bits
85 if b < cbit {
86 base += df
87 vals <- base
88 df = 0
89 k = 0
90 j += 1
91 }
92 }
93 close(vals)
94 }()
95 return vals
96}
97
98func (s *Set) IterSlice() []int {
99 vals := make([]int, s.count)

Callers 5

BenchmarkChanUnbufferedFunction · 0.80
BenchmarkBuffered8Function · 0.80
BenchmarkBuffered16Function · 0.80
BenchmarkBuffered32Function · 0.80
BenchmarkBuffered64Function · 0.80

Calls 1

closeFunction · 0.50

Tested by 5

BenchmarkChanUnbufferedFunction · 0.64
BenchmarkBuffered8Function · 0.64
BenchmarkBuffered16Function · 0.64
BenchmarkBuffered32Function · 0.64
BenchmarkBuffered64Function · 0.64