func BenchmarkExt1Insert(b *testing.B) { j, n := 0, len(data) f := cuckoo2.NewCuckooFilter(uint(n)) for i := 0; i < b.N; i++ { f.Insert(data[j]) if j++; j == n { j = 0 } } }
func initExt1(wg *sync.WaitGroup) { j, n := 0, len(data) fullFilter2 = cuckoo2.NewCuckooFilter(uint(n)) for i := 0; i < n; i++ { fullFilter2.Insert(data[j]) if j++; j == n { j = 0 } } wg.Done() }
func main() { cf := cuckoofilter.NewCuckooFilter(16000000) scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { line := scanner.Text() success := cf.Insert([]byte(line)) if !success { log.Fatal("FAAAAIL!") os.Exit(1) } } log.Printf("Added %d entries.", cf.GetCount()) for _, pw := range pws { if cf.Lookup([]byte(pw)) { log.Printf("Contains '%s'\n", pw) } else { log.Printf("Yay, not in list: '%s'\n", pw) } } }