Remix.run Logo
KingOfCoders a day ago

Your thinking is too complex for Go. You might be better of with Rust.

Same about benchmarking, if you want and need the fastest code, or the best memory management, use Rust.

If you need something faster than Python in general but not the fastest, use Go.

nulld3v a day ago | parent [-]

But that's the thing right? Like I come from Java. In Java, we have objects. They are pointers. That's it. You don't get to decide on whether you want a pointer or a value (I guess primitives are an exception lol). But it was so simple!

And same in JavaScript. Everything is a pointer except primitives. That's it. End of story.

And I have written Rust too, and while the situation is definitely more complicated there, the guidance is extremely simple and straightforward: If the struct implements Copy, then it is very cheap to copy and you should pass by value. Otherwise, you should pass by pointer/reference.

And meanwhile in Go, I just see pointers and values being used seemingly interchangeably, and seemingly at random.