mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 11:27:50 +00:00
add benchmark for import and snapshot
This commit is contained in:
parent
6374fedd7a
commit
b8b2b58804
1 changed files with 65 additions and 0 deletions
|
|
@ -1098,3 +1098,68 @@ func BenchmarkFragment_Snapshot(b *testing.B) {
|
|||
}
|
||||
}
|
||||
}
|
||||
func BenchmarkFragment_FullSnapshot(b *testing.B) {
|
||||
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
|
||||
defer f.Close()
|
||||
// Generate some intersecting data.
|
||||
maxX := 1048576 / 2
|
||||
sz := maxX
|
||||
rows := make([]uint64, sz, sz)
|
||||
cols := make([]uint64, sz, sz)
|
||||
|
||||
max := 0
|
||||
for row := 0; row < 100; row++ {
|
||||
val := 1
|
||||
i := 0
|
||||
for col := 0; col < SliceWidth/2; col++ {
|
||||
rows[i] = uint64(row)
|
||||
cols[i] = uint64(val)
|
||||
val += 2
|
||||
i++
|
||||
}
|
||||
if err := f.Import(rows, cols); err != nil {
|
||||
b.Fatalf("Error Building Sample: %s", err)
|
||||
}
|
||||
if row > max {
|
||||
max = row
|
||||
}
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err := f.Snapshot(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkFragment_Import(b *testing.B) {
|
||||
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
|
||||
defer f.Close()
|
||||
maxX := 1048576 * 5 * 2
|
||||
sz := maxX
|
||||
rows := make([]uint64, sz, sz)
|
||||
cols := make([]uint64, sz, sz)
|
||||
i := 0
|
||||
for row := 0; row < 100; row++ {
|
||||
val := 1
|
||||
for col := 0; col < SliceWidth/2; col++ {
|
||||
rows[i] = uint64(row)
|
||||
cols[i] = uint64(val)
|
||||
val += 2
|
||||
i++
|
||||
}
|
||||
if i == maxX {
|
||||
break
|
||||
}
|
||||
}
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err := f.Import(rows, cols); err != nil {
|
||||
b.Fatalf("Error Building Sample: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue