Esempio n. 1
0
func runStoreBench(b *testing.B, storeType string, documents int) {
	mystore, err := NewStore(storeType, "test.db")
	if err != nil {
		b.Error(err)
		return
	}
	defer os.RemoveAll("test.db")
	for n := 0; n < b.N; n++ {
		for doc := 0; doc < documents; doc++ {
			b.StopTimer()
			ips := ipset.New()
			for i := 0; i < 30000; i++ {
				ips.AddString(loggen.PartiallyRandomIPv4(2))
			}
			b.StartTimer()
			mystore.AddDocument(fmt.Sprintf("test-%d-%d.txt", doc, n), *ips)
		}
	}
}
Esempio n. 2
0
func doBenchmarkAddingRandomN(b *testing.B, n int) {
	ips := New()
	for i := 0; i < b.N; i++ {
		ips.AddString(loggen.PartiallyRandomIPv4(n))
	}
}