by gwbas1c · 5y ago · 0 comments
> In C#, for example, reference objects and value objects live entirely separate lives. Value objects are always passed by value. You cannot take the the address of a value object and pass that around. No, you need to copy the whole object every time.
In C#, there are normal, C-style pointers. (Although they aren't used very often, mostly when interoperating with C APIs.) Furthermore, you can pass a struct by reference if copying the struct is a problem.
I once wrote some performance critical code where I used structs and past them around by pointers. I ran the code through a profiler, and then refactored to use normal idiomatic non-pointer code. After running through a profiler there was no performance difference.
---
The author of this post really needs to base their claims on actual data. Some well-tuned programs in the languages compared and then compare the performance.
I am not even talking about GCs, I am talking about the intellectual rigor we should use when discussing quantitative subjects. To do anything else is to practice magic.
Research papers on GCs will outline the comparisons and metrics they use to study GC algorithms.
Make sure the code is idiomatic and optimized.
Those are basically opposite ends of the same axis.
Heavily optimized code is never idiomatic in any language. If the natural, idiomatic code were fast enough it wouldn’t need to be optimized!