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
Currently getting this warning on the range function, is that expected
'func' passes a lock by the value: type 'globals.RequestArtifacts' contains 'sync.WaitGroup' contains 'interface{}' which is 'sync.Locker'
Here's some preceding context
test := xsync.NewMapOf[string, globals.RequestArtifacts]()
test.Range(func(key string, value globals.RequestArtifacts) bool {
When I change test schema structure to
test := xsync.NewMapOf[string, *globals.RequestArtifacts]()
test.Range(func(key string, value *globals.RequestArtifacts) bool {
warning clears. Do our xsync generic types need to be pointers to structs instead of the struct itself? Do we lose or not gain any performance boost by using pointers?
The text was updated successfully, but these errors were encountered:
Do our xsync generic types need to be pointers to structs instead of the struct itself? Do we lose or not gain any performance boost by using pointers?
Internally, key and value is stored in the following struct:
So, if the struct is "simple" (no mutexes), you should use the struct and it will be copied. This is preferred for performance reasons. If not, pointers must be used.
Currently getting this warning on the range function, is that expected
Here's some preceding context
When I change test schema structure to
warning clears. Do our xsync generic types need to be pointers to structs instead of the struct itself? Do we lose or not gain any performance boost by using pointers?
The text was updated successfully, but these errors were encountered: