cpu: AMD Ryzen 5 PRO 4650G with Radeon Graphics

BenchmarkBinaryEncoding/event2.MarshalJSON-12 15 74245789 ns/op

BenchmarkBinaryEncoding/event2.EventToBinary-12 162 7429203 ns/op

BenchmarkBinaryEncoding/easyjson.Marshal-12 60 21221235 ns/op

BenchmarkBinaryEncoding/gob.Encode-12 18 62426577 ns/op

BenchmarkBinaryEncoding/binary.Marshal-12 9 112783137 ns/op

BenchmarkBinaryDecoding/event2.UnmarshalJSON-12 14 90464147 ns/op

BenchmarkBinaryDecoding/event2.BinaryToEvent-12 100 12832888 ns/op

BenchmarkBinaryDecoding/easyjson.Unmarshal-12 57 23280946 ns/op

BenchmarkBinaryDecoding/gob.Decode-12 5 226555916 ns/op

BenchmarkBinaryDecoding/binary.Unmarshal-12 128 8563056 ns/op

the output from https://mleku.dev/nostrbench

Reply to this note

Please Login to reply.

Discussion

now with the pubkey encoding as binary... not as dramatic an improvement it seems

oh well, anyway, it's done now, both id and pubkey fields now do not need any hex encode/decode so that's still a good thing

last is the signature... this will be another 5-10 ops more i figure, then i'm gonna get out the profiler

goos: linux

goarch: amd64

pkg: mleku.net/nostrbench

cpu: AMD Ryzen 5 PRO 4650G with Radeon Graphics

BenchmarkBinaryEncoding/event2.MarshalJSON-12 14 72883244 ns/op

BenchmarkBinaryEncoding/event2.EventToBinary-12 166 7090886 ns/op

BenchmarkBinaryEncoding/easyjson.Marshal-12 67 18620409 ns/op

BenchmarkBinaryEncoding/gob.Encode-12 19 62998941 ns/op

BenchmarkBinaryEncoding/binary.Marshal-12 10 110464204 ns/op

BenchmarkBinaryDecoding/event2.UnmarshalJSON-12 13 87762713 ns/op

BenchmarkBinaryDecoding/event2.BinaryToEvent-12 100 12388974 ns/op

BenchmarkBinaryDecoding/easyjson.Unmarshal-12 57 23463646 ns/op

BenchmarkBinaryDecoding/gob.Decode-12 5 226411371 ns/op

BenchmarkBinaryDecoding/binary.Unmarshal-12 123 8851251 ns/op

#devstr #benchmark #nostr

since switching up the binary encoder for sure the relay is running way way faster... also because i fixed the shit slow logging library, that was a big part of it, none of these other libraries even have logging! if mine has an error it prints a log! so it's still faster and dev friendly at the same time

bah humbug of course i has bugs now, very weirdness

it looks like i broke the filters, that would be why it returns zero counts all the time and zero results get sent, and then idk why not sending eose either, but hey gotta expect gotchas like this... i'll fix em tomorrow most likely, and become aware of how they got broken so when i do the signatures i don't get surprised like this

it does send out the messages to subscribers when i post it but filter searches are b0rked

ok, bug found... funny enough the first change i made was bugged... the event IDs... was all wrong totally... only took a few minutes to get it generating the correct output and plugging that into the filters and suddenly all these results are coming back from the filters coming in from clients

also, the bug was slowing down the encoder... this is now typical results

goos: linux

goarch: amd64

pkg: mleku.net/nostrbench

cpu: AMD Ryzen 5 PRO 4650G with Radeon Graphics

BenchmarkBinaryEncoding/event2.MarshalJSON-12 14 74456910 ns/op

BenchmarkBinaryEncoding/event2.EventToBinary-12 172 6911613 ns/op

BenchmarkBinaryEncoding/easyjson.Marshal-12 63 18776462 ns/op

BenchmarkBinaryEncoding/gob.Encode-12 19 62966594 ns/op

BenchmarkBinaryEncoding/binary.Marshal-12 9 118801192 ns/op

BenchmarkBinaryDecoding/event2.UnmarshalJSON-12 14 88550098 ns/op

BenchmarkBinaryDecoding/event2.BinaryToEvent-12 100 12272410 ns/op

BenchmarkBinaryDecoding/easyjson.Unmarshal-12 58 23138193 ns/op

BenchmarkBinaryDecoding/gob.Decode-12 5 227175445 ns/op

BenchmarkBinaryDecoding/binary.Unmarshal-12 126 8782942 ns/op

i'm still puzzled why the BinaryToEvent is unaffected though... gonna get to it yet, for now, all is well with the world, my relay is actually finding events and sending them back

actually, no, i only fixed one case, looks like the pubkeys are broken