Re:Making a Go program 70% faster with a one character change
by strifey on Monday November 14, 2022 @01:01PM
(#33598134)
If you're familiar with Python and Go, you'll likely be able to quickly spot the differences in how they handle parameter passing. Python uses references and Go uses value.
[ Parent
| on HN ]
Re:Making a Go program 70% faster with a one character change
by erik_seaberg on Monday November 14, 2022 @01:56PM
(#33599035)
Go maps and channels have reference semantics. Slices are passed and returned by value, but state may be shared (not copied) in an error-prone way, so it’s safest to pretend they have move semantics and treat only one copy as valid.
IMHO they should have used pointers everywhere they didn’t want value semantics.