forked from TrueCloudLab/frostfs-sdk-go
[#168] netmap: Add simple selector benchmark
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
b91e25f782
commit
7d19718e1d
1 changed files with 24 additions and 0 deletions
|
@ -80,3 +80,27 @@ func TestPlacementPolicy_Interopability(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
func BenchmarkManySelects(b *testing.B) {
|
||||
testsFile := filepath.Join("json_tests", "many_selects.json")
|
||||
bs, err := ioutil.ReadFile(testsFile)
|
||||
require.NoError(b, err)
|
||||
|
||||
var tc TestCase
|
||||
require.NoError(b, json.Unmarshal(bs, &tc))
|
||||
tt, ok := tc.Tests["Select"]
|
||||
require.True(b, ok)
|
||||
|
||||
nodes := NodesFromInfo(tc.Nodes)
|
||||
nm, err := NewNetmap(nodes)
|
||||
require.NoError(b, err)
|
||||
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err = nm.GetContainerNodes(&tt.Policy, tt.Pivot)
|
||||
if err != nil {
|
||||
b.FailNow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue