Sunday, October 15, 2017

Packet Refinements (Update)

It turns out that I wasn't thinking properly about the problem, and it didn't take long to come up with a better solution for packet encoding. Should have tried a simpler solution to start with. I replaced the bytes.Buffer with a static buffer of the target packet length. Here are the results:

BenchmarkEncodeMsgConnectEx-8           30000000              40.6 ns/op
BenchmarkEncodeUsingReflection-8         2000000               674 ns/op

Encoding now also shows improvement by a multiple of about 17. Cheers.

No comments:

Post a Comment