2021-08-26 08:20:27 +00:00
|
|
|
package hd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-09-07 06:36:11 +00:00
|
|
|
ethermint "github.com/cerc-io/laconicd/types"
|
2021-08-26 08:20:27 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkEthSecp256k1Algo_Derive(b *testing.B) {
|
|
|
|
b.ReportAllocs()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
deriveFn := EthSecp256k1.Derive()
|
|
|
|
if _, err := deriveFn(mnemonic, keyring.DefaultBIP39Passphrase, ethermint.BIP44HDPath); err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkEthSecp256k1Algo_Generate(b *testing.B) {
|
|
|
|
bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, ethermint.BIP44HDPath)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
b.ResetTimer()
|
|
|
|
b.ReportAllocs()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
(ðSecp256k1Algo{}).Generate()(bz)
|
|
|
|
}
|
|
|
|
}
|