been working on new things today... one was a integer to bytes encoder and i tried my hand at a hex encoder the integer encoder was a win, 2x faster than using strings goos: linux goarch: amd64 pkg: github.com/mleku/nodl/pkg/utils/ints cpu: AMD Ryzen 5 PRO 4650G with Radeon Graphics BenchmarkByteStringToInt64/Int64AppendToByteString-12 100000000 10.45 ns/op BenchmarkByteStringToInt64/ByteStringToInt64ToByteString-12 68144872 20.47 ns/op BenchmarkByteStringToInt64/Itoa-12 41371257 28.11 ns/op BenchmarkByteStringToInt64/ItoaAtoi-12 33901826 35.95 ns/op the hex encoder, however, has already been made bleeding fast goos: linux goarch: amd64 pkg: github.com/mleku/nodl/pkg/utils/hex cpu: AMD Ryzen 5 PRO 4650G with Radeon Graphics BenchmarkAppendHexToByteString/AppendHexToByteString-12 2508732 481.0 ns/op BenchmarkAppendHexToByteString/AppendHexToByteStringToHex-12 1000000 1007 ns/op BenchmarkAppendHexToByteString/hex.AppendEncode-12 11465517 106.0 ns/op BenchmarkAppendHexToByteString/hex.AppendEncodeDecode-12 7106614 169.5 ns/op my idea of doing the calculation with a little arithmetic turned out to be 10x slower than the stdlib but in any case, i've now got the fastest possible number encoder for the datestamps and kind numbers in tags, and i know that hex.AppendEncode and hex.Decode are fine now to move on to implementing the elements and putting together the new event and filter formats, binary and json encoding my previous json encoder ended up using reflect which is why it was slow, so hopefully it'll be nice and fast this time #devstr #benchmarks #golang

1
0
3

0
0
3

Showing page 1 of 1 pages