aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/benchmarks_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'whisper/whisperv5/benchmarks_test.go')
-rw-r--r--whisper/whisperv5/benchmarks_test.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/whisper/whisperv5/benchmarks_test.go b/whisper/whisperv5/benchmarks_test.go
index f2eef3c47..417b2881b 100644
--- a/whisper/whisperv5/benchmarks_test.go
+++ b/whisper/whisperv5/benchmarks_test.go
@@ -34,7 +34,6 @@ func BenchmarkDeriveOneTimeKey(b *testing.B) {
}
}
-//func TestEncryptionSym(b *testing.T) {
func BenchmarkEncryptionSym(b *testing.B) {
InitSingleTest()
@@ -181,3 +180,33 @@ func BenchmarkDecryptionAsymInvalid(b *testing.B) {
}
}
}
+
+func increment(x []byte) {
+ for i := 0; i < len(x); i++ {
+ x[i]++
+ if x[i] != 0 {
+ break
+ }
+ }
+}
+
+func BenchmarkPoW(b *testing.B) {
+ InitSingleTest()
+
+ params, err := generateMessageParams()
+ if err != nil {
+ b.Fatalf("failed generateMessageParams with seed %d: %s.", seed, err)
+ }
+ params.Payload = make([]byte, 32)
+ params.PoW = 10.0
+ params.TTL = 1
+
+ for i := 0; i < b.N; i++ {
+ increment(params.Payload)
+ msg := NewSentMessage(params)
+ _, err := msg.Wrap(params)
+ if err != nil {
+ b.Fatalf("failed Wrap with seed %d: %s.", seed, err)
+ }
+ }
+}