From 0ecffe686dc6329b072be0cecc967da108a3140c Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 4 Nov 2023 10:06:34 -0300 Subject: [PATCH] binary decoding performance gains are negligible. --- binary/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/binary/README.md b/binary/README.md index aaa3f18..678f9d8 100644 --- a/binary/README.md +++ b/binary/README.md @@ -2,6 +2,7 @@ Some benchmarks: +``` goos: linux goarch: amd64 pkg: github.com/nbd-wtf/go-nostr/binary @@ -16,3 +17,8 @@ BenchmarkBinaryDecoding/easyjson.Unmarshal+sig-4 307 39719 BenchmarkBinaryDecoding/binary.Unmarshal+sig-4 310 3924042 ns/op 111277 B/op 421 allocs/op PASS ok github.com/nbd-wtf/go-nostr/binary 11.444s +``` + +This is 2~5x faster than [NSON](../nson) decoding, which means 8x faster than default easyjson decoding, +but, just like NSON, the performance gains from this encoding is negligible when you add the cost of +signature verification. Which means this encoding must only be used in internal processes.