News for hackers. Stuff that matters.
Re:Making a Go program 70% faster with a one character change by cbsmith on Monday November 14, 2022 @05:31PM (#33602265)
> For anything 64 bits or smaller, value semantics are pretty much always going to be better.

That's assuming a 64-bit CPU (which admittedly seems like a reasonable assumption. The nice thing about the abstraction though is that there's nothing preventing the runtime from applying value semantics for those trivial small-object cases where they're obviously more efficient.

Re:Making a Go program 70% faster with a one character change by account42 on Tuesday November 15, 2022 @04:31AM (#33607099)
Even for a 32-bit CPU a 64-bit type is only two words to copy - and in many cases those "copies" are just register loads. In contrast, reference types means to even access it you have to read the reference and then indirectly load the memory it points to. You have to really make something contrived where a two-word type ends up being more efficient as a reference than as a value.