simd is faster when your cpu supports it. afaik this is not widely available specifically in personal devices.
git clone https://github.com/nbd-wtf/go-nostr
cd go-nostr
go test -bench=BenchmarkParseMessage -run=NothingAtAll -v
Please run this and let me know if the "simd" variant is faster or slower than the "golang" variant. From my tests one or the other will be many times faster than the other depending on the machine, I don't understand why, so maybe we can get some patterns. Thank you.
Discussion
so, buy a server with simd support and run it there.
i didn't know we can use simd on golang. it's mostly available on rust/zig. if i found an ok solution and ive confirmed datacenters widely support it, i will make it available on immortal.
i like making event parsing/verification blazingly fast.
Please paste your benchmarks.
goos: linux
goarch: amd64
pkg: github.com/nbd-wtf/go-nostr
cpu: 12th Gen Intel(R) Core(TM) i3-12100F
BenchmarkParseMessage
BenchmarkParseMessage/golang
BenchmarkParseMessage/golang-8 162 6665196 ns/op
BenchmarkParseMessage/simdjson
BenchmarkParseMessage/simdjson-8 28 43713545 ns/op
PASS
ok github.com/nbd-wtf/go-nostr 3.138s
i was not aware of simdjson on go...
but it seems its for 2 years ago. forking it? you do it or i can go for it?
also, these stuff like simdjson and linsecp245k1 in golang has a lot of overhead, what is your opinion?
Why fork it? Why? What are you going to change in it?
last update is 2 years ago. not up to date with main simdjson library...
JSON hasn't changed much in this period.
what about simdjosn library? 🤔
https://github.com/simdjson/simdjson
lot of commits since then.