fixup Fragment_Import benchmark

It was doing a fresh import on the first round and then importing the same data
into the fragment over and over.
This commit is contained in:
Matt Jaffee 2019-03-05 08:47:44 -06:00
parent 7af64e382c
commit 6fe1ab45c2
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -1904,8 +1904,7 @@ func BenchmarkFragment_FullSnapshot(b *testing.B) {
}
func BenchmarkFragment_Import(b *testing.B) {
f := mustOpenFragment("i", "f", viewStandard, 0, "")
defer f.Clean(b)
b.StopTimer()
maxX := 1048576 * 5 * 2
sz := maxX
rows := make([]uint64, sz)
@ -1924,17 +1923,19 @@ func BenchmarkFragment_Import(b *testing.B) {
}
}
rowsUse, colsUse := make([]uint64, len(rows)), make([]uint64, len(cols))
copy(rowsUse, rows)
copy(colsUse, cols)
b.ResetTimer()
b.ReportAllocs()
options := &ImportOptions{}
for i := 0; i < b.N; i++ {
// since bulkImport modifies the input slices, we make new copies for each round
copy(rowsUse, rows)
copy(colsUse, cols)
f := mustOpenFragment("i", "f", viewStandard, 0, "")
b.StartTimer()
if err := f.bulkImport(rowsUse, colsUse, options); err != nil {
b.Fatalf("Error Building Sample: %s", err)
b.Errorf("Error Building Sample: %s", err)
}
b.StopTimer()
f.Clean(b)
}
}