Add benchmark for adding a torrent with a lot of pieces

This commit is contained in:
Matt Joiner 2015-06-22 19:43:22 +10:00
parent b2b290a589
commit d8cf0f1e34
2 changed files with 16 additions and 0 deletions

View 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()
}
}

BIN
testdata/bootstrap.dat.torrent vendored Normal file

Binary file not shown.