MCPcopy Create free account
hub / github.com/dgraph-io/dgraph-benchmarks / compare

Function compare

scripts/verify/main.go:113–139  ·  view source on GitHub ↗
(srcl, dstl []R)

Source from the content-addressed store, hash-verified

111}
112
113func compare(srcl, dstl []R) {
114 var buf bytes.Buffer
115 var ps, ds, loop, matches int
116 for ps < len(srcl) && ds < len(dstl) {
117 loop++
118 if loop%100 == 0 {
119 //fmt.Printf(".")
120 }
121 s := srcl[ps]
122 d := dstl[ds]
123 if equal(s, d) {
124 //fmt.Printf("Found match: %v\n", s)
125 matches++
126 ps++
127 ds++
128 } else if less(s, d) {
129 // s < d, advance s
130 buf.WriteString(s.String())
131 buf.WriteRune('\n')
132 ps++
133 } else {
134 ds++
135 }
136 }
137 fmt.Printf("Found matches: %v\n", matches)
138 x.Check(ioutil.WriteFile(*out, buf.Bytes(), 0644))
139}
140
141func main() {
142 flag.Parse()

Callers 1

mainFunction · 0.85

Calls 3

equalFunction · 0.85
lessFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected