chore(db): benchmark output, migration blocks/s output (#10320)

Just minor tweaks
This commit is contained in:
Jakob Borg
2025-08-29 16:58:38 +02:00
committed by GitHub
parent 0de55ef262
commit 2306c6d989
2 changed files with 19 additions and 2 deletions

View File

@@ -31,10 +31,16 @@ func BenchmarkUpdate(b *testing.B) {
})
fs := make([]protocol.FileInfo, 100)
t0 := time.Now()
seed := 0
size := 1000
const numBlocks = 1000
const numBlocks = 500
fdb, err := db.getFolderDB(folderID, true)
if err != nil {
b.Fatal(err)
}
for size < 200_000 {
for {
@@ -54,6 +60,17 @@ func BenchmarkUpdate(b *testing.B) {
}
}
var files, blocks int
if err := fdb.sql.QueryRowx(`SELECT count(*) FROM files`).Scan(&files); err != nil {
b.Fatal(err)
}
if err := fdb.sql.QueryRowx(`SELECT count(*) FROM blocks`).Scan(&blocks); err != nil {
b.Fatal(err)
}
d := time.Since(t0)
b.Logf("t=%s, files=%d, blocks=%d, files/s=%.01f, blocks/s=%.01f", d, files, blocks, float64(files)/d.Seconds(), float64(blocks)/d.Seconds())
b.Run(fmt.Sprintf("n=Insert100Loc/size=%d", size), func(b *testing.B) {
for range b.N {
for i := range fs {