What do you think is faster: filling an array with one million structs, or filling an array with one million classes?
Mark Farragher ask himself What Is Faster In C#: A Struct Or A Class? – C# Architects – on Medium. But of course the third version is faster because he’s not comparing apples and oranges!
The first two routines handles the points by reference while in the third by value. Speaking in Eiffel, the first two versions are “normal” classes, the third is an expanded one. It makes a world of difference!
Well, I do acknowledge that many programming languages does not make the difference manifest.
Pages: 1 2