go-gtp icon indicating copy to clipboard operation
go-gtp copied to clipboard

add an example of marshalling using reflect

Open Baron-Rouge opened this issue 3 years ago • 2 comments
trafficstars

add MarshalTo() and MarshalLen() for GTPv2 echo request using reflect package

reflection can be used in order to define Marshal functions once for all. here is an example with GTPv2 echo request message. Message interface may be used to apply this to all messages types.

Baron-Rouge avatar Feb 22 '22 13:02 Baron-Rouge

I'm generally not in favor of using reflection in the packet processing, as there may be a concern in performance. Could you add some benchmarks to show the difference?

wmnsk avatar Mar 29 '22 01:03 wmnsk

I just added benchmarks for GTPv2 echo request and create session request. Marshalling using reflect is two to four times slowler than current Marshalling.

Baron-Rouge avatar Apr 26 '22 15:04 Baron-Rouge