Closed antoninbas closed 11 months ago
Before change:
goos: darwin
goarch: amd64
pkg: github.com/vmware/go-ipfix/pkg/test
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkCollector/ipv4-12 304 3809314 ns/op 1832212 B/op 45001 allocs/op
BenchmarkCollector/ipv6-12 304 3852429 ns/op 1922795 B/op 45000 allocs/op
PASS
After change:
goos: darwin
goarch: amd64
pkg: github.com/vmware/go-ipfix/pkg/test
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkCollector/ipv4-12 306 3785402 ns/op 1512218 B/op 44001 allocs/op
BenchmarkCollector/ipv6-12 310 3828923 ns/op 1602773 B/op 44000 allocs/op
PASS
@heanlan @dreamtalen let me know if you think this is not a correct change (functionality-wise)
Merging #331 (6d7c889) into main (c5e0992) will decrease coverage by
0.39%
. The diff coverage is26.31%
.
LGTM
Do we still need to keep the original
AddRecord
?
Since it's a public API of the library, and there was no strong reason to remove it, I just kept it
Avoid unnecessary slice creation when adding a record to a set. We implement this change for both data record and template records, but in practice most of the gains will come from data records.
Memory allocations (in bytes) are reduced by around 15% for BenchmarkCollector.