]> Sergey Matveev's repositories - btrtrc.git/blob - storage/mark-complete_test.go
Drop support for go 1.20
[btrtrc.git] / storage / mark-complete_test.go
1 package storage_test
2
3 import (
4         "testing"
5
6         "github.com/anacrolix/torrent/storage"
7         test_storage "github.com/anacrolix/torrent/storage/test"
8 )
9
10 func BenchmarkMarkComplete(b *testing.B) {
11         bench := func(b *testing.B, ci storage.ClientImpl) {
12                 test_storage.BenchmarkPieceMarkComplete(
13                         b, ci, test_storage.DefaultPieceSize, test_storage.DefaultNumPieces, 0)
14         }
15         b.Run("File", func(b *testing.B) {
16                 ci := storage.NewFile(b.TempDir())
17                 b.Cleanup(func() { ci.Close() })
18                 bench(b, ci)
19         })
20         b.Run("Mmap", func(b *testing.B) {
21                 ci := storage.NewMMap(b.TempDir())
22                 b.Cleanup(func() { ci.Close() })
23                 bench(b, ci)
24         })
25         b.Run("BoltDb", func(b *testing.B) {
26                 ci := storage.NewBoltDB(b.TempDir())
27                 b.Cleanup(func() { ci.Close() })
28                 bench(b, ci)
29         })
30 }