Skip to content

Commit

Permalink
remove some more unnecessary stuff from internal/binary.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Sep 30, 2024
1 parent e87a3d0 commit 5917346
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 81 deletions.
37 changes: 0 additions & 37 deletions internal/binary/binary_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,6 @@ import (
"github.com/nbd-wtf/go-nostr/test_common"
)

func BenchmarkBinaryEncoding(b *testing.B) {
events := make([]*nostr.Event, len(test_common.NormalEvents))
binaryEvents := make([]*Event, len(test_common.NormalEvents))
for i, jevt := range test_common.NormalEvents {
evt := &nostr.Event{}
json.Unmarshal([]byte(jevt), evt)
events[i] = evt
binaryEvents[i] = BinaryEvent(evt)
}

b.Run("easyjson.Marshal", func(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, evt := range events {
easyjson.Marshal(evt)
}
}
})

b.Run("gob.Encode", func(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, evt := range events {
var buf bytes.Buffer
gob.NewEncoder(&buf).Encode(evt)
_ = buf.Bytes()
}
}
})

b.Run("binary.Marshal", func(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, evt := range events {
Marshal(evt)
}
}
})
}

func BenchmarkBinaryDecoding(b *testing.B) {
events := make([][]byte, len(test_common.NormalEvents))
gevents := make([][]byte, len(test_common.NormalEvents))
Expand Down
44 changes: 0 additions & 44 deletions internal/binary/event.go

This file was deleted.

0 comments on commit 5917346

Please sign in to comment.