lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Apr 10, 2014 at 10:26 AM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Thu, Apr 10, 2014 at 11:41 AM, steve donovan
> <steve.j.donovan@gmail.com> wrote:
>> And that's exactly the point - even experienced users of the language
>> would not know what to expect, because there _could_ be a magic
>> metamethod.
>>
>> -1 for this one,  it really causes confusion.
>
>
> IMHO, all this is because there's no real tuple value type, and we're
> treating the varargs '...' and multiple return values as some "almost
> a tuple" thing.  but it's not the same thing.
>
> a real tuple type, with destructuring assingments, would solve all
> this in a simple and transparent way.  but replacing varargs with a
> tuple or list, and multiple return values with returning a tuple just
> to be immediately destructured might have a serious performance
> impact, likely from a huge increase in object allocation (except if
> you're using LuaJIT and Mike's magic banishes all those temporary
> objects from existence)
>

Whenever I hear about avoiding temporary tables, I wonder if the
concern is based on theory, micro benchmarking or real-world
application problems.

I know that it is true that performance and garbage collection are "a
thing." At first, I went through some effort to avoid that in some of
my code. Now, I've stopped because I've never been able to whiteness a
side effect of creating a ton of temporary tables.

Is avoiding temporary tables an effort that is worthy on tiny
micro-controller but not on a PC? Are there times when this flavor of
small, temporary garbage has really mattered, even on a PC?

I'm doing all of my logic inside of the few mills between frames that
I can afford to steal away from the C code that actually does the
heavy lifting and I've never been able to measure *any* impact.

-Andrew

> --
> Javier
>