Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Abandoned
-
None
-
None
-
None
Description
Currently, we're passing around si.EventRecord objects as a pointer to a value. The idea is that by keeping just a single value in memory, we reduce copying. However, this causes heap allocations, which puts pressure on the GC, plus dereferencing also has costs.
Also, modification to a structure is reflected in the original object. We rarely want this without adequate locking.
Since this is a simple struct that is based on a protobuf definition, we should abandon heavy pointer usage and just pass it as value.
See a relevant benchmark about passing struct as value vs pointer:
https://medium.com/a-journey-with-go/go-should-i-use-a-pointer-instead-of-a-copy-of-my-struct-44b43b104963