On Tue, 15 Dec 2009 18:41:30 -0500, Simen kjaeraas <[email protected]> wrote:

Steven Schveighoffer <[email protected]> wrote:

On Mon, 14 Dec 2009 11:44:18 -0500, lws <[email protected]> wrote:

On 2009-12-14 07:01:47 -0800, dsimcha <[email protected]> said:

1. Well, stuff like this is good warning to whomever about the code. Since D is a imperative language, it should at least give you a warning when you're doing something really inefficient that has a boilerplate way of accomplishing it that is much faster.

It's not faster, it's slower. Passing a reference to an integer or smaller value type is not as efficient passing the value type itself.

This is hardly true on modern architectures. I don't have the numbers on
it, but even for ints and floats, ref is just as fast (and sometimes
faster).

I don't see how this is possible. It's a double-indirection vs. a single indirection when you look at the value.

Yes, it might be inlined, making the lookup just as fast as if it were a stack variable, but I don't see how it could be faster. I guess it may be faster if you don't actually use the value in the function.

Besides that point, passing ints or floats by value is not "something really inefficient" that should be considered a compiler error.

-Steve

Reply via email to