You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've searched for any related issues and avoided creating a duplicate issue.
Description
Currently go-audit uses the stdlib encoding/json class to marshal the AuditMessageGroup and AuditMessage structs into a []byte. Internally the encoding/json package uses reflection so it can marshal arbitrary objects.
Because go-audit only uses two static structures there would likely be a significant performance improvement using a code generation library like easyjson to serialize the structures into bytes.
You can find various benchmarks on JSON serialization performance across code generation packages vs stdlib but I am partial to go_serialization_benchmarks:
benchmark
iter
time/iter
bytes/op
allocs/op
tt.sec
tt.kb
ns/alloc
BenchmarkJsonMarshal-8
1000000
1585 ns/op
304
4
1.58
30400
396.25
BenchmarkEasyJsonMarshal-8
1000000
1125 ns/op
784
5
1.12
78400
225.00
This comes at the cost of an additional dependency (primarily when the models change only)
The text was updated successfully, but these errors were encountered:
Description
Currently go-audit uses the stdlib
encoding/json
class to marshal theAuditMessageGroup
andAuditMessage
structs into a[]byte
. Internally theencoding/json
package uses reflection so it can marshal arbitrary objects.Because go-audit only uses two static structures there would likely be a significant performance improvement using a code generation library like easyjson to serialize the structures into bytes.
You can find various benchmarks on JSON serialization performance across code generation packages vs stdlib but I am partial to go_serialization_benchmarks:
This comes at the cost of an additional dependency (primarily when the models change only)
The text was updated successfully, but these errors were encountered: