#When making methods on structs is it better for performance to not pass the struct as a pointer?
5 messages · Page 1 of 1 (latest)
Unless it is a very large struct I guess it doesn't matter, if it is, I guess I'd use a pointer.
Also maps are reference types, which means that when you pass a map to a function or assign it to a variable, you are actually passing a reference to the original map.
If you want to know when it's better to pass pointers vs vals, look up the go ABI for your particular architecture.
this probably isn't a good benchmark. you should use the built-in benchmarking tools to figure out stuff like this.