You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Xray-core/proxy/vmess/validator_test.go

35 lines
624 B

4 years ago
package vmess_test
import (
"testing"
4 years ago
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/uuid"
. "github.com/xtls/xray-core/proxy/vmess"
4 years ago
)
func toAccount(a *Account) protocol.Account {
account, err := a.AsAccount()
common.Must(err)
return account
}
func BenchmarkUserValidator(b *testing.B) {
for i := 0; i < b.N; i++ {
v := NewTimedUserValidator()
4 years ago
for j := 0; j < 1500; j++ {
id := uuid.New()
v.Add(&protocol.MemoryUser{
Email: "test",
Account: toAccount(&Account{
Id: id.String(),
4 years ago
}),
})
}
common.Close(v)
}
}