mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
benchmark import instead of set on existence field
This commit is contained in:
parent
f7abf60627
commit
a89e1c521b
1 changed files with 14 additions and 4 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue