FedP2P/storage/mark-complete_test.go

31 lines
749 B
Go
Raw Normal View History

package storage_test
import (
"testing"
"github.com/anacrolix/torrent/storage"
test_storage "github.com/anacrolix/torrent/storage/test"
)
func BenchmarkMarkComplete(b *testing.B) {
bench := func(b *testing.B, ci storage.ClientImpl) {
test_storage.BenchmarkPieceMarkComplete(
2021-05-05 19:36:36 +08:00
b, ci, test_storage.DefaultPieceSize, test_storage.DefaultNumPieces, 0)
}
b.Run("File", func(b *testing.B) {
ci := storage.NewFile(b.TempDir())
b.Cleanup(func() { ci.Close() })
bench(b, ci)
})
b.Run("Mmap", func(b *testing.B) {
ci := storage.NewMMap(b.TempDir())
b.Cleanup(func() { ci.Close() })
bench(b, ci)
})
b.Run("BoltDb", func(b *testing.B) {
ci := storage.NewBoltDB(b.TempDir())
b.Cleanup(func() { ci.Close() })
bench(b, ci)
})
}