[#149] Add benchmarks

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2021-07-21 12:05:24 +03:00
parent 60bc0037fd
commit c7cf5afd2f

26
api/errors_test.go Normal file
View file

@ -0,0 +1,26 @@
package api
import (
"errors"
"testing"
)
func BenchmarkErrCode(b *testing.B) {
err := GetAPIError(ErrNoSuchKey)
for i := 0; i < b.N; i++ {
if IsS3Error(err, ErrNoSuchKey) {
_ = err
}
}
}
func BenchmarkErrorsIs(b *testing.B) {
err := GetAPIError(ErrNoSuchKey)
for i := 0; i < b.N; i++ {
if errors.Is(err, GetAPIError(ErrNoSuchKey)) {
_ = err
}
}
}