Skip to content

Commit d8cf0f1

Browse files
committed
Add benchmark for adding a torrent with a lot of pieces
1 parent b2b290a commit d8cf0f1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

client_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,19 @@ func TestCompletedPieceWrongSize(t *testing.T) {
388388
}
389389
defer tt.Drop()
390390
}
391+
392+
func BenchmarkAddLargeTorrent(b *testing.B) {
393+
cfg := TestingConfig
394+
cfg.DisableTCP = true
395+
cfg.DisableUTP = true
396+
cfg.ListenAddr = "redonk"
397+
cl, _ := NewClient(&cfg)
398+
defer cl.Close()
399+
for range iter.N(b.N) {
400+
t, err := cl.AddTorrentFromFile("testdata/bootstrap.dat.torrent")
401+
if err != nil {
402+
b.Fatal(err)
403+
}
404+
t.Drop()
405+
}
406+
}

testdata/bootstrap.dat.torrent

211 KB
Binary file not shown.

0 commit comments

Comments
 (0)