]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add benchmark for adding a torrent with a lot of pieces
authorMatt Joiner <anacrolix@gmail.com>
Mon, 22 Jun 2015 09:43:22 +0000 (19:43 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 22 Jun 2015 09:43:22 +0000 (19:43 +1000)
client_test.go
testdata/bootstrap.dat.torrent [new file with mode: 0644]

index cfdbd7eb5ec433f0c72b6a3b6cb8c52b21f192b4..3cd1f0ec398a81af7ea37f0d2d33ba590db3b2a7 100644 (file)
@@ -388,3 +388,19 @@ func TestCompletedPieceWrongSize(t *testing.T) {
        }
        defer tt.Drop()
 }
+
+func BenchmarkAddLargeTorrent(b *testing.B) {
+       cfg := TestingConfig
+       cfg.DisableTCP = true
+       cfg.DisableUTP = true
+       cfg.ListenAddr = "redonk"
+       cl, _ := NewClient(&cfg)
+       defer cl.Close()
+       for range iter.N(b.N) {
+               t, err := cl.AddTorrentFromFile("testdata/bootstrap.dat.torrent")
+               if err != nil {
+                       b.Fatal(err)
+               }
+               t.Drop()
+       }
+}
diff --git a/testdata/bootstrap.dat.torrent b/testdata/bootstrap.dat.torrent
new file mode 100644 (file)
index 0000000..e5cdeb7
Binary files /dev/null and b/testdata/bootstrap.dat.torrent differ