From a89e1c521becfe0a7291cc4fcb25e79925e18f83 Mon Sep 17 00:00:00 2001 From: Travis Turner Date: Tue, 11 Sep 2018 14:52:03 -0500 Subject: [PATCH] benchmark import instead of set on existence field --- executor_test.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/executor_test.go b/executor_test.go index 25465411c..5704e607b 100644 --- a/executor_test.go +++ b/executor_test.go @@ -1557,12 +1557,22 @@ func benchmarkExistence(nn bool, b *testing.B) { b.Fatal(err) } + bitCount := 10000 + req := &pilosa.ImportRequest{ + Index: indexName, + Field: fieldName, + Shard: 0, + RowIDs: make([]uint64, bitCount), + ColumnIDs: make([]uint64, bitCount), + } + for i := 0; i < bitCount; i++ { + req.RowIDs[i] = uint64(rand.Intn(100000)) + req.ColumnIDs[i] = uint64(rand.Intn(1 << 20)) + } + b.ResetTimer() for i := 0; i < b.N; i++ { - colID := uint64(rand.Intn(1 << 20)) - rowID := uint64(rand.Intn(100000)) - qry := fmt.Sprintf(`Set(%d, %s=%d)`, colID, fieldName, rowID) - if _, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: indexName, Query: qry}); err != nil { + if err := c[0].API.Import(context.Background(), req); err != nil { b.Fatal(err) } }