2 ms·
> But there’s nothing egregious about Golang here . Pass by value vs reference is a common performance issue. The trap here is that everything is passed by ref
by masklinn 4y ago
> But there’s nothing egregious about Golang here . Pass by value vs reference is a common performance issue.
The trap here is that everything is passed by reference (pointer), but the intermediate local value is, well, a value (a copy).
Rule is not a gigantic monster struct (it's 72 bytes), chances are returning it by value would not have been an issue.
Anyway I would say there is an issue with Go here: it's way too easy to copy out of a slice.